This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Math245 Computer Lab set #8, Fall 2008 Beat and resonance We consider the undamped linear, forced 2nd-order ODE in the form: y 00 + ω 2 y = F cos ω f t (1) where ω is the natural frequency of the system, ω f is the forcing frequency, and F is the forcing amplitude. Example let ω = 1, F = 1 / 2. y 00 + y = 1 2 cos ω f t. Simulate the system for ω f = 4 / 5 , 7 / 8 , 1 for 0 ≤ t ≤ 100. • Step #1: Let y = y 1 and y = y 2 , and rewriting the equation into a set of first order ODEs. y 1 = y 2 , (2) y 2 =- y 1 + 1 2 cos ω f t. (3) • Step #2: Define RHS of above ODEs in a function file. function dy=odefun(t,y,omgf) dy=[ y(2)-y(1)+0.5*cos(omgf*t) ]; • Step #3: Write the main program, and run it for different value of ω f . omgf=4/5; tspan=[0,100]; y0=[0,0]; [t, y]=ode45(@odefun,tspan,y0,,omgf); figure plot(t,y(:,1)) Solution plot is shown in figure below. Analytical solution Analytical solution to Eqn(1) is written y ( t ) = F ω 2- ω 2 f (cos ω f t- cos ω t ) . (4) Using trigonometric identity...
View Full Document
This note was uploaded on 11/08/2009 for the course MATH 245 at USC.