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

1 Ansicht (letzte 30 Tage)
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 Kommentare
Brittany Burns
Brittany Burns am 27 Jul. 2021
I do. It's stated in the hw problem as using that
Stephen23
Stephen23 am 28 Jul. 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

Melden Sie sich an, um zu kommentieren.

Antworten (1)

David Hill
David Hill am 27 Jul. 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 Kommentare
Jan
Jan am 28 Jul. 2021
"Does not work" is not useful to explain, what the problem is. Please post a copy of the ecomplete error message.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Gravitation, Cosmology & Astrophysics finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by