This preview shows pages 1–3. 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: cos ( t /10)x end Listing 4: fun4.m % Steady state % beta ( t ) = 1 function xprime = fun4 ( t , x) xprime = 1x end Next, we set up the range over which the simulation is done (0 to 200 π at intervals of π/ 4), and deﬁne the initial value of X * as zero. Listing 5: Range and initial value tspan = [ 0 : pi /4:200 * pi ] x0 = 0 Finally, we invoke the ODE solver ode45 built into Matlab, and plot the results. Listing 6: Solve and plot [ t1 , x1 ] = ode45 (@fun1 , tspan , x0 ) ; [ t2 , x2 ] = ode45 (@fun2 , tspan , x0 ) ; [ t3 , x3 ] = ode45 (@fun3 , tspan , x0 ) ; [ t4 , x4 ] = ode45 (@fun4 , tspan , x0 ) ; plot ( t1 , x1 , ’ r’ , t2 , x2 , ’g’ , t3 , x3 , ’b’ , t4 , x4 , ’’ ) ; The plot should look like the one below. The red line is for fast switching, green for matched, blue for slow, and dotted for the steady state case. 2 3...
View
Full
Document
This note was uploaded on 03/30/2010 for the course SBE 580.429 taught by Professor Joelbader during the Fall '09 term at Johns Hopkins.
 Fall '09
 JoelBader

Click to edit the document details