ezplot is plotting a blank plot

조회 수: 1 (최근 30일)
Brenda Galabe
Brenda Galabe 2018년 12월 12일
편집: Cris LaPierre 2018년 12월 12일
no errors nut plot is blank
syms y(x)
a=2;
b=6;
c=1;
d= 8;
e = 6;
ode = diff(y,x) == (-d*x)/(e*y);
ysol = vpa(dsolve(ode))
ezplot(ysol(1))
hold on
ezplot(ysol(2))

답변 (3개)

Mark Sherstan
Mark Sherstan 2018년 12월 12일
You need to solve for your constant C2 otherwise your function is no longer in terms of just x which is a requirment of ezplot.
  댓글 수: 2
Brenda Galabe
Brenda Galabe 2018년 12월 12일
THIS EQUATION DID PLOT AND IT HAD CONSTANTS TOO, whats the difference between the tw0
syms y(x)
a=2;
b=6;
c=1;
ode = diff(y,x) == (a*x*y)/(b*x^2-c*y^2);
ysol = vpa(dsolve(ode))
ezplot(ysol(1))
hold on
ezplot(ysol(2))
ezplot(ysol(3)
Cris LaPierre
Cris LaPierre 2018년 12월 12일
편집: Cris LaPierre 2018년 12월 12일
You did not try to plot the solution that contains constant C5 (ysol(4)). Your plots are for
  • 0
  • 2x
  • -2x

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


Cris LaPierre
Cris LaPierre 2018년 12월 12일
편집: Cris LaPierre 2018년 12월 12일
You equation has two variables. You need to provide a value for for ezplot to be able to plot the functions.
Also, best to heed the warnings in the documentation - use fplot instead of ezplot.
If I use fplot and substitute in a value for C2, your code works.
...
ysol = subs(ysol,'C2',25)
fplot(ysol(1))
hold on
fplot(ysol(2))

Brenda Galabe
Brenda Galabe 2018년 12월 12일
this error happens instead
Index exceeds matrix dimensions.
Error in fplot (line 56)
lims = args{2};
  댓글 수: 1
Cris LaPierre
Cris LaPierre 2018년 12월 12일
I didn't realize you were using an older version of MATLAB. The behavior will be different. Use ezplot for now.

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

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

제품


릴리스

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by