How to solve y'=y^2+3y-2 for some y(0)
4 views (last 30 days)
Show older comments
Hi there,
I want/have to solve the following diff. equation y'=y^2+3y-2 for y1(0)=2, y2(0)=5 and y3(0)=6. I am new to MATLAB so I don't really know how to do that. I know that I have to use ode etc. but I keep getting various errors so I haven't understood the basic concept yet. I hope that some of you guys can help me out? Not necessarily the solution but maybe some hints.
Best
0 Comments
Answers (1)
Walter Roberson
on 3 Sep 2017
syms y(x) y0
Y = dsolve(diff(y)==y^2+3*y-2, y(0)==y0);
simplify( subs(Y, y0, 2) )
simplify( subs(Y, y0, 6) )
2 Comments
Walter Roberson
on 4 Sep 2017
ode45( @(t, y) y.^2 + 3*y - 2, [0 1], 2 )
Note: there is a singularity at about 0.328
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!