Info
この質問は閉じられています。 編集または回答するには再度開いてください。
Hi, I'm trying to figure out why my script is only ploting the last input angle, not regarding any of the loops before it.
1 回表示 (過去 30 日間)
古いコメントを表示
function [ ] = odeSolver2()
tInc = input('Input desired timestep (in seconds)');
% Set initial conditions
Z = input('Input desired Landing distance (in meters)');
t(1)=0;
Ang1 = input('First angle of shooting (in degrees)');
Ang2 = input('Last angle of shooting (in degrees)');
AInc = input('Angle increment (also in degrees)');
Err = input('Acceptable Error (in meters)');
w = (Ang2-Ang1)/AInc;
IAng = linspace(Ang1,Ang2,w);
for n=1:w;
z(:,1,n) = VelocityforAngle(IAng(n));
end
i=1;
while z(3,i,n)>=0;
i=i+1;
t(i)=t(i-1)+tInc;
[z(:,i,n)] = oneStepRK(t(i-1), z(:,i-1,n), tInc);
end
j=1;
while abs(z(1,j)-Z)<=Err
j=j+1;
t(j)=t(j-1)+tInc;
[z(:,j,n)] = oneStepRK(t(j-1), z(:,j-1,n), tInc);
end
hold on figure(1);
plot(z(1,:),z(3,:))
xlabel('x')
ylabel('y')
axis ([0 12000 0 10000])
1 件のコメント
Jan
2012 年 11 月 30 日
Please learn how to format code in this forum. Inserting a white line after each line of code reduces the readability too much.
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!