|
From: | Scott Kuntze |
Subject: | Re: simulating dynamical systems with arbitrary external inputs using lsode |
Date: | Fri, 22 Jun 2007 15:43:10 -0400 |
User-agent: | Thunderbird 1.5.0.12 (X11/20070604) |
John W. Eaton wrote:
function retval = u (t) if (t < 5) retval = 1; elseif (t < 10) retval = -1; elseif (t < 15) retval = 1; else retval = 0; endif endfunction
Using an input function like this does indeed work -- I've used it to define rectangular pulses and the like -- but it doesn't solve the problem of setting u(t) to reference an arbitrary waveform that could be loaded from an experimental data file.
For example, if 'waveform' is a distorted waveform with transients and noise, it quickly becomes difficult to write mathematical representations with if / then statements. The other suggestion to use polyfit on 'waveform' is an interesting one, but again it will break down if 'waveform' is extremely complex (which it could be).
Any other suggestions on getting lsode to use an arbitrary input vector?I guess I'm surprised this isn't simple to do -- I'm simply trying to compare a dynamic model to an experiment, and would like to use the exact input I captured from the experiment as the input into the simulation.
[Prev in Thread] | Current Thread | [Next in Thread] |