{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

lab6solutions - ECE220 LAB6 Solution%Example 7.30%The array...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
1 ECE220 LAB6 Solution %Example 7.30 %The array v contains the solution %Set up the initial conditions v(1,1)=1; v(2,1)=0; t(1)=0; %Setup the step size h=0.001; %Set up the recursion for 10000 steps N=10000; %Set up the A matrix . A=[0 1;-7/4 -1/2]; for k=1:N t(k+1)=t(k)+h; v(:,k+1)=v(:,k)+h*A*v(:,k)+h*[0;5*sin(10*pi*t(k))]; end %Now plot the solution plot(t,v(1,:)); grid on xlabel( 't' ) ylabel( 'v(t)' ) 0 1 2 3 4 5 6 7 8 9 10 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1 1.2 t v(t) Underdamped Case
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon