Skip to content
Permalink
master
Go to file
 
 
Cannot retrieve contributors at this time
26 lines (25 sloc) 753 Bytes
set(0, 'defaultAxesFontSize', 16)
set(0,'defaultTextFontSize',14)
set(0,'defaultLineLineWidth',1)
dt=0.1;
x=[0:dt:20]';
y_n=zeros(length(x),4);
y_n(1,:)=[10 0 0 2];
for i=2:length(x)
dy=phugoid_ode(x(i-1),y_n(i-1,:));
y_n(i,:)=y_n(i-1,:)+dt*dy;
end
dt=0.01;
x=[0:dt:20]';
y_n2=zeros(length(x),4);
y_n2(1,:)=[10 0 0 2];
for i=2:length(x)
dy=phugoid_ode(x(i-1),y_n2(i-1,:));
y_n2(i,:)=y_n2(i-1,:)+dt*dy;
end
[t23,y23]=ode23(@(t,y) phugoid_ode(t,y),[0 20],[10 0 0 2]);
d = figure(4);
plot(y_n(:,3),y_n(:,4),y_n2(:,3),y_n2(:,4),y23(:,3),y23(:,4))
legend('Euler .1','Euler .01','ode23','Location','Northeast')
xlabel('Distance')
ylabel('Height')
You can’t perform that action at this time.