{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

quiz7_solution

# quiz7_solution - ylabel'Distance(m title'Forced Harmonic...

This preview shows page 1. Sign up to view the full content.

function [] = resonance_onefunc() %RESONANCE_SCRIPT - a function that solves the differential %equation m*(d2x/dt2) = -k*x - F*cos(w*t) of a forced harmonic oscillator %for x(t) and v(t). File written by S.C. Tegler. Last modified 3/21/11. tspan=[0 3]; %time interval of solution x0=[0;0]; %initial conditions [t,x]=ode45( @resonance ,tspan,x0); %call to function and solve ode plot(t,x(:,1), '-k' ); %begin plotting grid; xlabel( 'Time (sec)'
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ); ylabel( 'Distance (m)' ); title( 'Forced Harmonic Oscillator at Resonance' ); function xdot = resonance(t,x) %RESONANCE - function containing ode of forced harmonic oscillator %at resonance. File written by S.C. Tegler. Last modified 3/3/2011. %----------------------------------------------------------------% wo=2*pi*5; %natural frequency w=2.0*pi*5; %forced frequency xdot=[x(2);-wo^2*x(1)+600*cos(w*t)]; %ode end end...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online