Fimplicit not plotting properly

조회 수: 19 (최근 30일)
Nethanel Benzaquen
Nethanel Benzaquen 2020년 12월 3일
댓글: Walter Roberson 2020년 12월 3일
Hello,
Im trying to implicity plot conic sections using this deffinition in the app desinger.
fun1=@(x,y) a.*x.^2+2*h.*x.*y+b*y.^2+2*g.*x+2*f.*y+c;
after inputing
a=2 , 2*h=0, b=0, 2*g=3, 2*f=1, c=7
fimplicit is returning a blank graph although this is a perfectly fine parabola.
when plotting it with a linspace as such:
xx=-10:10;
yy=-2.*xx.^2-7.*xx-7;
plot(xx,yy)
Matlab plots the function perfectly fine. So why does't the fimplicit plot it aswell.
thanks

채택된 답변

Stephan
Stephan 2020년 12월 3일
편집: Stephan 2020년 12월 3일
fun1=@(x,y) a.*x.^2+2*h.*x.*y+b*y.^2+2*g.*x+2*f.*y+c;
a=2;
h=0;
b=0;
g=3/2;
f=1/2;
c=7;
fimplicit(fun1,[-3 2 -12 -5])
  댓글 수: 2
Nethanel Benzaquen
Nethanel Benzaquen 2020년 12월 3일
Thanks!
do you know why when writting the code like this
fun1=@(x,y) a.*x.^2+2*h.*x.*y+b*y.^2+2*g.*x+2*f.*y+c;
fimplicit(app.ax1,fun1);
xlim(app.ax1,'auto')
ylim(app.ax1,'auto')
the xlim and ylim didn't work. The Idea is for any value of coefficients i should see the graph. but in this specif case it didnt show it to me
Stephan
Stephan 2020년 12월 3일
No, i also did not get it to work in an automatic way...

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

추가 답변 (1개)

Walter Roberson
Walter Roberson 2020년 12월 3일
a=2; h=0/2; b=0; g=3/2; f=1/2; c=7;
fun1=@(x,y) a.*x.^2+2*h.*x.*y+b*y.^2+2*g.*x+2*f.*y+c;
fimplicit(fun1, [-10 10 -10 10])
Looks plausible to me.
  댓글 수: 2
Nethanel Benzaquen
Nethanel Benzaquen 2020년 12월 3일
Thanks!
do you know why when writting the code like this
fun1=@(x,y) a.*x.^2+2*h.*x.*y+b*y.^2+2*g.*x+2*f.*y+c;
fimplicit(app.ax1,fun1);
xlim(app.ax1,'auto')
ylim(app.ax1,'auto')
the xlim and ylim didn't work. The Idea is for any value of coefficients i should see the graph. but in this specif case it didnt show it to me
Walter Roberson
Walter Roberson 2020년 12월 3일
Setting the xlim or ylim has no effect on the range that fimplicit uses to plot, and changing the limits to auto after the call does not trigger an already existing fimplicit to go back and analyze the function to find a range of bounds that will give an interesting plot. fimplicit only draws according to the range passed in or the default for the fimplicit call.
You are not passing in limits and the default limits happen to have no interesting content for this function.

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

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by