Fimplicit not plotting properly

26 Ansichten (letzte 30 Tage)
Nethanel Benzaquen
Nethanel Benzaquen am 3 Dez. 2020
Kommentiert: Walter Roberson am 3 Dez. 2020
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

Akzeptierte Antwort

Stephan
Stephan am 3 Dez. 2020
Bearbeitet: Stephan am 3 Dez. 2020
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 Kommentare
Nethanel Benzaquen
Nethanel Benzaquen am 3 Dez. 2020
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 am 3 Dez. 2020
No, i also did not get it to work in an automatic way...

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Walter Roberson
Walter Roberson am 3 Dez. 2020
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 Kommentare
Nethanel Benzaquen
Nethanel Benzaquen am 3 Dez. 2020
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 am 3 Dez. 2020
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.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Line Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by