how to save the index during for loop?

1 Ansicht (letzte 30 Tage)
vimal kumar chawda
vimal kumar chawda am 23 Jul. 2019
Beantwortet: David K. am 23 Jul. 2019
How to save the index data and as i am not getting it? i have mention in the loop my question.
thank you
l=30000;
m=1;
n=180;
k=1;
c20=-0.00108263;
GM=398600.44; %unit is in km^3/s^2
%%unknown data
i=1.11784815920563;
e=0.00381415453739464;
a_e=26560.4021; %semi-major of the earth value is in km
a=26500; % semi major axis of the GPS
n = sqrt(GM/(a*a*a));
%% help me in the loop for plotting ????????????????????????
for a=6838:1:l
i=deg2rad(55);
e=0.01;
d_omega_drei(k,:)=(3*n*c20*a_e^(2))/(4*(((1-(e*e))^(2))*a^(2)))*(1-5*cos(i)^(2));
d_Omega_drei(k,:)=(3*n*c20*a_e*a_e)/(2*((1-(e*e))*(1-(e*e)))*a*a)*cos(i);
k=k+1;
end
%case-1
figure();
grid on
xlabel('Omega dot and omega dot')
ylabel('a')
plot(d_omega_drei,a);
hold on
plot(d_Omega_drei,a);
hold off

Antworten (1)

David K.
David K. am 23 Jul. 2019
A couple different things can fix this, but I would suggest this one just creating the variable a again after your for loop ->
for a = 6838:1:l
...
end
a = 6838:1:l;
Also, after doing this if the plot looks weird to you still, I would suggest switching a and d_omega_drei in your plotting.

Kategorien

Mehr zu Resizing and Reshaping Matrices 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