Multiply each element of a matrix by different element from another matrix
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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
Respuestas (1)
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
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.
Ver también
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!