help-octave
[Top][All Lists]
Advanced

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

Re: LSODE Question - External Inputs?


From: Juan Pablo Carbajal
Subject: Re: LSODE Question - External Inputs?
Date: Thu, 23 Feb 2012 19:04:32 +0100

On Thu, Feb 23, 2012 at 6:46 PM, damian.harty
<address@hidden> wrote:
> I made some progress passing in the variables for m, k and c:
>
> one_dof.m:
>
>
>
> EqMotion.m:
>
>
>
> I should politely point out that if the impression is widely held that the
> manual entry for anonymous functions explains that, then it doesn't - your
> reply was much clearer than the manual entry.
>
> Emboldened by this, I thought I would try passing in my "u" vector. The u
> vector is a displacement applied to the base of the system, determined in
> advance - an "obstacle", if you like. The example is a pretty trivial one
> but it paves the way for various things now.
>
> This was my attempt:
>
> one_dof.m:
>
>
>
> EqMotion.m:
>
>
>
> So, right now I see what I expect to see. Whether or not it's the best way
> to code it I have no idea, in particular making a copy of the time vector to
> pass in twice seems strange but I can't work out how not to need it for
> interpolation of the u vector I passed in. If there is a better way to take
> the derivative on the fly I'd like to hear it, too.
>
> Other than that, I think it's mission accomplished for the moment.
>
> Many thanks for both replies, without which I would have failed dismally!
>
> Damian
>
> -----
> Senior Research Fellow - Vehicle & System Dynamics
> Coventry University
> United Kingdom
> --
> View this message in context: 
> http://octave.1599824.n4.nabble.com/LSODE-Question-External-Inputs-tp4414228p4414606.html
> Sent from the Octave - General mailing list archive at Nabble.com.
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://mailman.cae.wisc.edu/listinfo/help-octave

You could pass function handles instead of vector.
There is the function data2fun.m, that creates a function handle form
data. I think is well documented, if it is not I will be happy to
improve the help. You can get that function from signal-1.1.2. It is
very simple, it uses interp1 to generate the handle. If you check
inside you will see how to do it.

Once generated you pass the handle instead of the vector and inside
your function you evaluate it at the current time. Check the second
demonstration here
http://octave.sourceforge.net/signal/function/sigmoid_train.html it
uses lsode in this way.

Good luck.


-- 
M. Sc. Juan Pablo Carbajal
-----
PhD Student
University of Zürich
http://ailab.ifi.uzh.ch/carbajal/


reply via email to

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