ODE with discrete, external input
Afficher commentaires plus anciens
Hi everybody, I want to solve a simple ODE for specific discrete time points in which constats are updated externally for each specific t value. vgr
t=1:100; dy/dt=kt;
where k is a external vector with length=length(t) and wich is considered in the equation for each t.... any help? thanks in advance
Réponse acceptée
Plus de réponses (1)
Torsten
le 31 Oct 2014
0 votes
Use
if K1 and K2 don't depend explicitly on t, but on the dependent variables x and y.
Best wishes
Torsten.
4 commentaires
Hi Torsten, thanks for your answer! K1, K2 don't depend on t(!) that is correct! I have cheked the griddata, could you give a more concrete example in how I can implement this (griddata)
To use griddata from matlab:
vq = griddata(x,y,v,xq,yq)
I need: x,y,v and xq,yq are the query points right? I have x,y and v, but when I try griddata in matlab I get:
Undefined function or variable 'xq'
Thanks!
Torsten
le 31 Oct 2014
I guess your dependent variables y(1) and y(2) from the ODE integrator are the xq and yq variables, aren't they?
So you have to call griddata like
K1=griddata(xK1,yK1,vK1,y(1),y(2))
K2=griddata(xK2,yK2,vK2,y(1),y(2))
if vK1 is your given vector of K1 values at points (xK1,yK1) and vK2 is your given vector of K2 values at points (xK2,yK2).
Best wishes
Torsten.
Thanks! but I still don't understand! Sorry!
I have another example here which is more easier but which can help me to understand.
Assume I have:
x1 = 40:0.005:55;
x1=x1';
x2=40:0.005:55;
x2=x2';
And then I discretize the following function:
V1=x1.*(0.2-0.005*x2);
V2=x2.*(-0.5+0.01*x1);
How can I use griddata now? And how can I solve this as an ODE?
Torsten
le 3 Nov 2014
Sorry, but meanwhile, I don't understand what you are trying to do.
Please specify more clearly:
What is the ODE you are trying to solve ?
Which MATLAB program are you trying to use to solve your ODE ?
Which kind of external input data do you have and where do they enter the ODE ?
Best wishes
Torsten.
Catégories
En savoir plus sur Ordinary Differential Equations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!