help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Non homogeneous differential equations


From: David Grohmann
Subject: Re: Non homogeneous differential equations
Date: Tue, 22 May 2007 13:56:39 -0500
User-agent: Thunderbird 1.5.0.10 (Windows/20070221)

Am I the only one seeing these emails without newlines? I'm using thunderbird 1.5 on windows xp.

--
David Grohmann
Senior Student Associate
Applied Research Lab : UT Austin : ESL - S206
Office: 512-835-3237



François Poulain wrote:
Thank you for your help, but it doesn't work in octave : you can see 
thecomputation below. I already tried some things like that, and I didn'tfind 
any way to solve this problem ...
octave:1> function xdot = f (x, t, uf, tauf)> persistent a = 1> persistent b = 1> u = uf (t);> xdot = [-a*x(4)*sin(x(3))+u(1);> -a*x(4)*cos(x(3))+u(2);> -x(4)+u(3);> b*(x(1)*sin(x(3))+x(2)*cos(x(3)))-tauf(t)];> endfunctionoctave:2> t = linspace (0, 1, 101);octave:3> x = lsode (@ (x, t) f (x, t, @ (t) t.^((0:2)'), @sin), zeros(4, 1),t);error: lsode: first arg should be a string or 2-element string arrayerror: evaluating assignment expression near line 3, column 4octave:3> Le mardi 22 mai 2007 à 10:09 +1000, Geordie McBain a écrit :> Hi. Thanks for the explanation of the forcing. You can do this in GNU> Octave with lsode. Create the function m-file f.m:> > %<---> function xdot = f (x, t, uf, tauf)> persistent a = 1> persistent b = 1> u = uf (t);> xdot = [-a*x(4)*sin(x(3))+u(1);> -a*x(4)*cos(x(3))+u(2);> -x(4)+u(3);> b*(x(1)*sin(x(3))+x(2)*cos(x(3)))-tauf(t)];> endfunction> %<---> > And then invoke lsode like:> > %<---> t = linspace (0, 1, 101);> x = lsode (@ (x, t) f (x, t, @ (t) t.^((0:2)'), @sin), zeros (4, 1),> t);> %<---> > which will give you x as a 101 x 4 array.> > Hope that solves the problem.> > Geordie McBain> > > Send instant messages to your online friends http://au.messenger.yahoo.com > -- François Poulain <address@hidden>
_______________________________________________Help-octave mailing 
address@hidden://www.cae.wisc.edu/mailman/listinfo/help-octave




reply via email to

[Prev in Thread] Current Thread [Next in Thread]