Probably simple - ode45 and lsqcurvefit
Afficher commentaires plus anciens
This is probably really trivial, but what I need is a function that takes a vector of parameters and a vector of time and, with ode45, outputs the p values of the ode: dp/dt=b*p-d*p^2.
What I have is:
function dpdt=diffeqn(t,p,par)
b=par(1);
d=par(2);
dpdt=b*p-d*p^2
end
and then a separate script:
[year pdata]=ode45(@diffeqn,[year],p0,[],[0.015,0.001]);
disp(pdata)
This does work fine for what is needed, but I think I need this all in one function, in order to call it in a lsqcurvefit command.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Matrix Computations dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!