{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

HW1_3a

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

Problem 3 Part (a) Table of Contents ................................................................................................................................. 1 (1) Explicit Euler ........................................................................................................ 1 (2) CN ...................................................................................................................... 2 (3) RK2 ..................................................................................................................... 3 (4) RK4 ..................................................................................................................... 4 The system is second order and have pure imaginary eigenvaluves clear;clc theta0=10/360*2*pi; a=0;b=6;g=9.81;l=0.6; h1=0.15;h2=0.5;h3=1; t=a:0.001:b; theta= theta0*cos(sqrt(g/l)*t); [email protected](y2,t) y2; [email protected](y1,t) -g/l*y1; (1) Explicit Euler As we know from EE, the amplitude blows up at step n and has a lag phase error. Because the system have pure imaginary eigenvalues EE is unstable. E1=euler2(h1,a,b,theta0); E2=euler2(h2,a,b,theta0); E3=euler2(h3,a,b,theta0); figure(1) plot(E1(:,1),E1(:,2), '-' ,E2(:,1),E2(:,2), ':' ,E3(:,1),E3(:,2), '-.' ) hold on li=plot(t,theta, 'k' ); set(li, 'linewidth' ,1.5); hold off legend( 'h=0.15' , 'h=0.5' , 'h=1' , 'exact' ) title( 'Solution using EE' ) 1

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

View Full Document
(2) CN CN has no amplitude error but has a lag phase error. CN is more accurate than EE and has small phase shift. CN is unconditional stable. C1=CN2(h1,a,b,theta0);

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 ]}