[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: LSODE Question - External Inputs?
From: |
Olaf Till |
Subject: |
Re: LSODE Question - External Inputs? |
Date: |
Thu, 23 Feb 2012 17:06:18 +0100 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
On Thu, Feb 23, 2012 at 07:42:50AM -0800, damian.harty wrote:
> ...
> But what I can't really see is how to pass these two vectors into the
> function "xdot". (Actually it ought to be clear I can't work out how to pass
> anything into xdot without lsode having a sulk. I want to declare m, k and c
> externally and have them picked up inside xdot but can't work out how to do
> that, either)
> ...
This is an FAQ. Maybe there is already something in the manual for this, if
not, it should be included ...
To pass additional arguments for a passed function (for example with
lsode) you can use anonymous functions, like that:
# a and b are arguments with additional information
a = linspace (0, 1, 1001);
b.x = .1;
b.y = .2;
X = lsode (@ (x, t) fdot (x, t, a, b), x0, t);
If you are not familiar with anonymous functions, you should refer to the
manual first.
In the example, your user function would have to be something like
function ret = fdot (X, T, A, B)
...
A and B will be set to a and b when the function is called by lsode.
Olaf
--
public key id EAFE0591, e.g. on x-hkp://pool.sks-keyservers.net
signature.asc
Description: Digital signature
- LSODE Question - External Inputs?, damian.harty, 2012/02/23
- Re: LSODE Question - External Inputs?, Juan Pablo Carbajal, 2012/02/23
- Re: LSODE Question - External Inputs?,
Olaf Till <=
- Re: LSODE Question - External Inputs?, damian.harty, 2012/02/23
- Re: LSODE Question - External Inputs?, Juan Pablo Carbajal, 2012/02/23
- Re: LSODE Question - External Inputs?, damian.harty, 2012/02/24
- Re: LSODE Question - External Inputs?, Olaf Till, 2012/02/24
- Re: LSODE Question - External Inputs?, damian.harty, 2012/02/24
- Re: LSODE Question - External Inputs?, Juan Pablo Carbajal, 2012/02/24
- Re: LSODE Question - External Inputs?, damian.harty, 2012/02/24
- Re: LSODE Question - External Inputs?, Olaf Till, 2012/02/24
- Re: LSODE Question - External Inputs?, damian.harty, 2012/02/27
- Re: LSODE Question - External Inputs?, Jordi GutiƩrrez Hermoso, 2012/02/27