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!