Solving one non linear differential equation

5 visualizaciones (últimos 30 días)
Wim
Wim el 4 de Nov. de 2012
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

Respuestas (1)

Star Strider
Star Strider el 4 de Nov. de 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.

Categorías

Más información sobre Numerical Integration and Differential Equations en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by