Why is fimplicit not plotting x^2 = 0 ??

조회 수: 3 (최근 30일)
Mohit Kumar
Mohit Kumar 2020년 10월 1일
편집: Mohit Kumar 2020년 10월 1일
I have a code that takes in an implicit function from the user and then plots it. However, I ran into this odd problem where fimplicit is not plotting anything when the function is x^2. The code I entered :
fimplicit(@(x,y) x.^2,[-5 5 -5 5],'b-');
The output is just a plain white plot. No blue line at x=0. However, if I simply change my function to x.^2 - 1, everything works as expected. I'm guessing there is some trouble caused by the fact that x^2 is "tangential" to zero. (I know that this may be incorrect terminology.)
Is there any workaround for this?
EDIT: I am looking for a fix not only for the case of x.^2. The recommended solution must also be able to plot implicit functions as that is the primary requirement.
Thanks,
Mohit.

답변 (2개)

madhan ravi
madhan ravi 2020년 10월 1일
fplot()
  댓글 수: 1
Mohit Kumar
Mohit Kumar 2020년 10월 1일
The function entered by the user will, in general, be a function of x and y. As far as I understand, fplot works only for a single variable.
That is, the code below does not work.
fplot(@(x,y) x.^2)

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


KSSV
KSSV 2020년 10월 1일
x = linspace(-5,+5,100) ;
y = x.^2 ;
plot(x,y)
  댓글 수: 1
Mohit Kumar
Mohit Kumar 2020년 10월 1일
Perhaps I should have made this clearer in the question itself. The function entered by the user will, in general, be implicit. Say something like x^2*y^2+x^3*y^4+x+tan(x*y)+5=0.
That is why I cannot use plot.

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

카테고리

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

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by