[Top][All Lists]

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

Re: lsode and symbolic function handles

From: Colin Macdonald
Subject: Re: lsode and symbolic function handles
Date: Sat, 29 Feb 2020 09:48:00 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0

On 2020-02-28 10:34 p.m., Vikram Garg wrote:
Trying to declare the function handle as global (global bh = function_handle(b);) did not help. But I think there must be a way to do this, since we can use built in functions inside of the ode integrator functions.

global was my first suggestion too:

global bh   # note global here
bh = function_handle(b)

function xdot = ...
global bh   # note global here too
xdot = ...
xdot(1) = bh(x(1), x(2))...

What error did you get?  That works for me.

Another option would be to write an m-file, something like:

function_handle(bh, 'vars', [x, y], 'file', 'myrhs')

I'd probably prefer that for anything serious.


reply via email to

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