Solving one non linear differential equation
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi,
I have a question involving solving a NLDE. The equation is of the form: dx/dt = -C1*(C2+C3*x^(0.25))*x
I would like to solve this equation in MATLAB, and get x(t). I first tried to do this with a simple dsolve, but it says solution = 0.
Main code i used: solution = dsolve('Dx = ((-k*A)/(L*m*Cp))*(0.68+Const*x^(0.25))*x')
(all variables other than x are constants i have defined above.)
Is dsolve the right choice for this equation? I want to try ODE45 but i don't know how (syntax-wise) define this function so that i can input it in ODE45.
Can anyone make a suggestion? Maybe use of implicit ODE's?
Kind regards, Wim
0 commentaires
Réponses (1)
Star Strider
le 4 Nov 2012
See if this works for you:
DX = @(t,x) ((-k.*A)./(L.*m.*Cp)).*(0.68+Const.*x.^(0.25)).*x;
then call it as:
[T,Y] = ode45(DX, [linspace(0, 10, 1000)], [0.1]);
Since DX is set up as an anonymous function, you don't have to define it as a separate program file. It will also be able to access k, A, and all the other variables in your workspace.
0 commentaires
Voir également
Catégories
En savoir plus sur Numerical Integration and Differential Equations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!