Multiply each element of a matrix by different element from another matrix

3 visualizaciones (últimos 30 días)
I am trying to fix the for loop, so I can find Fsp for each angle, but xi is not the same dimension as Fsp. Xi is based on an angle theta, 0-360. Fsp is a function of Xi, Fspo, and Giss.
massg=10^-5:10; %mass [g]
mass=massg/1000; %mass [kg]
Ra_leo=2000; Ra_geo=35786; % altitude[km]
R=6378; %Radius of Earth [km]
riss=450+R; %ISS altitude [km]
rgps=20200+R;%GPS altitude [km]
rgeo=35786+R;%GEO altitude [km]
theta=0:360; %angle [degrees]
xi=cosd(theta); %shielding factor
%Graviational focusing factor
Giss=1+Ra_leo/riss;
Ggps=1+Ra_leo/rgps;
Ggeo=1+Ra_geo/rgeo;
% Calculate Forces
F1=(2.2E3.*mass.^.306+15).^-4.38;
F2=1.3E-19.*(mass+10.*mass.^11.*mass.^2+10.*mass.^27.*mass.^4).^-0.36;
F3=1.3E-16.*(mass+10^6.*mass.^2).^-0.85;
Fspo=3.15576E7.*(F1+F2+F3);
for i=1:length(Fspo)
for j=1:length(theta)
Fsp(j)=Fspo.*xi.*Giss;
end
end
  3 comentarios
Brittany Burns
Brittany Burns el 27 de Jul. de 2021
I do. It's stated in the hw problem as using that
Stephen23
Stephen23 el 28 de Jul. de 2021
"It's stated in the hw problem as using that"
They are extremely odd values to use. One should definitely not assume that academics do not make mistakes.
massg = 10.^(-5:1)
massg = 1×7
0.0000 0.0001 0.0010 0.0100 0.1000 1.0000 10.0000

Iniciar sesión para comentar.

Respuestas (1)

David Hill
David Hill el 27 de Jul. de 2021
massg=10^-5:10; %mass [g]
mass=massg/1000; %mass [kg]
Ra_leo=2000; Ra_geo=35786; % altitude[km]
R=6378; %Radius of Earth [km]
riss=450+R; %ISS altitude [km]
rgps=20200+R;%GPS altitude [km]
rgeo=35786+R;%GEO altitude [km]
theta=0:360; %angle [degrees]
xi=cosd(theta); %shielding factor
%Graviational focusing factor
Giss=1+Ra_leo/riss;
Ggps=1+Ra_leo/rgps;
Ggeo=1+Ra_geo/rgeo;
% Calculate Forces
F1=(2.2E3.*mass.^.306+15).^-4.38;
F2=1.3E-19.*(mass+10.*mass.^11.*mass.^2+10.*mass.^27.*mass.^4).^-0.36;
F3=1.3E-16.*(mass+10^6.*mass.^2).^-0.85;
Fspo=3.15576E7.*(F1+F2+F3);
%try meshgrid
[Fspo,xi]=meshgird(Fspo,xi);
Fsp=Fspo.*xi*Giss;%matrix with all the calculations
  2 comentarios
Jan
Jan el 28 de Jul. de 2021
"Does not work" is not useful to explain, what the problem is. Please post a copy of the ecomplete error message.

Iniciar sesión para comentar.

Categorías

Más información sobre Gravitation, Cosmology & Astrophysics en Help Center y File Exchange.

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by