how to plot a semi-stable solution to autonomous DE
Afficher commentaires plus anciens
I have been trying to plot this and am only able to do so for certain initial values of y (y(0)) and can't see why this is the case.
Can anyone tell me how to do this for all values of y(0)?
the equation is: dy/dt =k(1-y)^2.
First, I made an Mfile function for the RHS of this:
>>function ydot=semi(t,y) >>k=2 >>ydot=k*((1-y)^2)
Then, in the command window: >>tspan=[0 20]; >>y0=2; >>[t,y]=ode45('semi',tspan,yo); >>plot(t,y)
As I say, this seems to have worked for values of y_0<1 but when y_0>1, there is an error message reading:
Warning: Failure at t=4.999822e-01. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (8.881784e-16) at time t. > In ode45 at 309
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Programming dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!