Fimplicit not plotting properly

18 visualizzazioni (ultimi 30 giorni)
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

Risposta accettata

Stephan
Stephan il 3 Dic 2020
Modificato: Stephan il 3 Dic 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 Commenti
Nethanel Benzaquen
Nethanel Benzaquen il 3 Dic 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 il 3 Dic 2020
No, i also did not get it to work in an automatic way...

Accedi per commentare.

Più risposte (1)

Walter Roberson
Walter Roberson il 3 Dic 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 Commenti
Nethanel Benzaquen
Nethanel Benzaquen il 3 Dic 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 il 3 Dic 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.

Accedi per commentare.

Categorie

Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by