Plotting an implicit solution obtained by differential equation in MATLAB

syms y(x)
ode=diff(y,x)*(2+x-3*y^2)==(6*x^2-y+3);
cond=y(0)==3;
ySol(x)=dsolve(ode,cond);
fplot(ySol(x));
Hello, when I execute this code, the graph is like:
But it should be like:
So the right part of the graph is not plotted by MATLAB with this code.
I tried a different code to plot the implicit function graph but it gives an error:
syms y(x)
ode=diff(y,x)*(2+x-3*y^2)==(6*x^2-y+3);
cond=y(0)==3;
s=dsolve(ode,'Implicit',true,cond);
fimplicit(ySol(x));

Antworten (1)

Torsten
Torsten am 19 Feb. 2022
The solution to the differential equation with y(0) = 3 is only defined up to the point x where y' becomes Infinity.

1 Kommentar

syms y(x)
ode=(2*x*y+y^2)==diff(y,x)*(x^2);
cond=y(1)==1;
ySol(x)=dsolve(ode,cond);
fplot(ySol(x));
Thanks, but with this differential equation, the solution should be in (-infinity,2) according to initial value, but MATLAB plots right of the 2 as well. So, does it mean that it just does not continue to plot the parts of the graph if it is sees y' is not defined? Since in this condition, it graphs discontinuity but not underivatability.

Melden Sie sich an, um zu kommentieren.

Produkte

Version

R2021b

Gefragt:

am 19 Feb. 2022

Kommentiert:

am 20 Feb. 2022

Community Treasure Hunt

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

Start Hunting!

Translated by