{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

HW1_3b

This preview shows pages 1–4. Sign up to view the full content.

Problem 3 Part(b) Table of Contents (1)Exact solution ......................................................................................................... 1 (2)EE ........................................................................................................................ 1 (3)RK2 ..................................................................................................................... 2 (1)Exact solution S=subs(solve( 'x^2+c*x+g/l' )); sr=real(S(1));si=abs(imag(S(1))); t=a:0.01:b; theta=theta0.*exp(sr*t).*cos(si*t)+0.099327.*exp(sr*t).*sin(si*t); h1=0.15;h2=0.5;h3=1; (2)EE E1b=euler2b(h1,a,b,theta0); E2b=euler2b(h2,a,b,theta0); E3b=euler2b(h3,a,b,theta0); figure plot(E1b(:,1),E1b(:,2), '-' ) hold on li=plot(t,theta, 'k' ); set(li, 'linewidth' ,1.5); hold off legend( 'h=0.15' , 'exact' ) title( 'solution of EE when time step is small' ) figure plot(E2b(:,1),E2b(:,2),

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

View Full Document

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}