Lab 4 - Haonan - MAT Yu 275
Table Contents of
MAT 275 MATLAB LAB 4 NAME: Haonan Yu ..................................................................... 1
LAB DAY and TIME:F 1:30 - 2:20 PM PM ........................................................................... 1
Instructor:Salinas ................................................................................................................. 1
Exercise 1 .......................................................................................................................... 1
Exercise 2 6 ..........................................................................................................................
Exercise 3 .......................................................................................................................... 11
Exercise 4 1 3 ..........................................................................................................................
MAT MATLAB LAB 4 NAME: Haonan 275 Yu
LAB DAY and TIME:F 1:30 PM - 2:20 PM
Instructor:Salinas
Exercise 1
%a
function LAB04ex1
t0=0; tf=50; y0=[-.5;.5];
[t,Y]=ode45(@f,[t0,tf],y0,[]);
y=Y(:,1); v=Y(:,2); % y in output has 2 columns corresponding
figure (1);
plot(t,y, ,t,v,'b' 'r');
legend( ,'y(t)' 'v(t)=y''(t)');
ylim([-1.2,1.2]) grid on
figure (2)
plot(y,v); axis ; xlabel( ); ylabel(square 'y' 'v'); % phase plot
axis([-.5,1,-1.2,1.2])
grid on
end
1