Solving one non linear differential equation
5 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Star Strider
on 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 Comments
See Also
Categories
Find more on Numerical Integration and Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!