Solving differential equation using ode45 in a single file
3 views (last 30 days)
Show older comments
Hello
I need to solve the following ODE using ode45 function:
dy/dx=(y/x)-(y/x)^2, in interval 1<=x<=2, and initial condition of y(1)=1
I am struggling with creating a script in a single file without using a separate function file. I thought this would work but it gives an error:
[x,y]=ode45(@deriv, [1,2],1);
function dydx=deriv(x,y)
dydx=(y/x)-(y/x)^2
Any help would be appreciated.
Thanks
0 Comments
Answers (1)
See Also
Categories
Find more on Ordinary 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!