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 CenterFile Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by