This preview shows page 1. Sign up to view the full content.
Unformatted text preview: 29.1) The first step in this problem is to create a system of first order equations. This can be found on the attached sheet as hand calculations. The numerical solution problem is then broken up into parts: a) interval 1 to 2, b) interval 1 to 2.1 a) >> f = inline('[y(2);y(3);‐y(3).^2+3.*y(2).^3‐cos(y(1)).^2+exp(‐t).*sin(3.*t)]','t','y') f = Inline function: f(t,y) = [y(2);y(3);‐y(3).^2+3.*y(2).^3‐cos(y(1)).^2+exp(‐t).*sin(3.*t)] >> [T Y] = ode45(f,[1 2],[1;2;0]); *Command took approximately 12 seconds. >> theta = Y(:,1); >> plot(T,theta) b) The second part portion of the problem, over the interval from 1 to 2.1, was not able to be solved. When the interval was set to the limits of 1.0 and 2.1 the computation took an extremely long period of time. As stated above the computation time for the interval of 1 to 2 from part “a” took only around 12 seconds to complete. As the limits approached 1.0 to 2.1 the time required for the computation grew at an exponential rate. For the interval 1.00 to 2.01 below the computation time took approximately 1 minute. >> [T Y] = ode45(f,[1 2.01],[1;2;0]); *Computation took approximately 1 minute >> theta = Y(:,1); >> plot(T,theta) When the limits were expanded to 1.00 to 2.02 the computation was still not concluded after 40 minutes. >> [T Y] = ode45(f,[1 2.02],[1;2;0]); ??? Operation terminated by user during ==> inlineeval at 11 In ==> inline.feval at 36 INLINE_OUT_ = inlineeval(INLINE_INPUTS_, INLINE_OBJ_.inputExpr, INLINE_OBJ_.expr); In ==> ode45 at 324 f(:,2) = feval(odeFcn,t+hA(1),y+f*hB(:,1),odeArgs{:}); The reason MATLab cannot calculate the graph as the time approaches 2.1 is because of the exponential nature of the equation as time approaches the asymptote. The value of theta will go to infinity before time 2.1 is reached. ...
View
Full
Document
This note was uploaded on 01/15/2011 for the course MATH 345 taught by Professor Staff during the Spring '08 term at Ohio State.
 Spring '08
 Staff

Click to edit the document details