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

1 次查看(过去 30 天)
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 个评论
Stephen23
Stephen23 2021-7-28
"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

请先登录,再进行评论。

回答(1 个)

David Hill
David Hill 2021-7-27
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

类别

Help CenterFile Exchange 中查找有关 Gravitation, Cosmology & Astrophysics 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by