Solving one non linear differential equation

5 次查看(过去 30 天)
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

回答(1 个)

Star Strider
Star Strider 2012-11-4
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.

类别

Help CenterFile Exchange 中查找有关 Numerical Integration and Differential Equations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by