plotting two parametric functions in same figure

3 visualizaciones (últimos 30 días)
Danny Van Elsen
Danny Van Elsen el 6 de Oct. de 2019
Comentada: Star Strider el 6 de Oct. de 2019
I was trying to plot a parametric function, and its inverse, like this:
t= linspace (-30, +30);
x= t;
y= (t.^5) + t + 1;
plot(x,y)
hold on
% t= linspace (-30, +30); <-- no difference
xx= (t.^5) + t + 1;
yy= t;
plot(xx,yy)
but this gives an empty plot, just showing axes with a far larger range than -30:30
what would I be doing wrong?
regards,D.

Respuesta aceptada

Danny Van Elsen
Danny Van Elsen el 6 de Oct. de 2019
ah, yes, I see.
adding
ylim([-10 10])
xlim([-10 10])
gives other results
thanks for your patience there...
  1 comentario
Star Strider
Star Strider el 6 de Oct. de 2019
You never mentioned that you just wanted to limit the axes ranges.

Iniciar sesión para comentar.

Más respuestas (1)

Star Strider
Star Strider el 6 de Oct. de 2019
You are not doing anything wrong, you are simply misinterpreting the results. The first function would plot with ‘t’ on the x-axis, going from (-30,30). The second function does the reverse of this, and so the plot adapts to the largest range on both axes, going from to .
(Also, the plot is not empty when I plot it.)
  2 comentarios
Star Strider
Star Strider el 6 de Oct. de 2019
Danny Van Elsen‘s Answer moved here —
thank you for your response!
but my output is consistently empty:
I get the expected result when entering either of the two functions alone, but nothing when entering both?
regards, D.
Star Strider
Star Strider el 6 de Oct. de 2019
My pleasure!
It is not empty. It shows the two functions crossing each other. The lines are not the plot axes. The blue line is the plot of (x,y), and the red line is the plot of (xx,yy).

Iniciar sesión para comentar.

Categorías

Más información sobre Annotations en Help Center y File Exchange.

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by