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));

답변 (1개)

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

댓글 수: 1

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.

댓글을 달려면 로그인하십시오.

제품

릴리스

R2021b

질문:

2022년 2월 19일

댓글:

2022년 2월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by