how to save the index during for loop?

1 回表示 (過去 30 日間)
vimal kumar chawda
vimal kumar chawda 2019 年 7 月 23 日
回答済み: David K. 2019 年 7 月 23 日
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

回答 (1 件)

David K.
David K. 2019 年 7 月 23 日
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.

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by