Plotting a parabola and an ellipse on the same graph

38 vues (au cours des 30 derniers jours)
Amber Porter
Amber Porter le 26 Jan 2022
Commenté : Amber Porter le 26 Jan 2022
Very new to MatLab and feeling clueless. I need to plot a parabola and an ellipse on the same graph. I have wrote the code and separately it produces the parabola and the epplise but together it will not, it just ignores the ellipse. I have attempted to use the hold on/off command but that isn't helping either. I'll paste my code below, any help would be fab, thanks!
x=linspace(-50, 50)
y= 2*x.^2-16*x+28
plot(x,y)
grid on
ylabel ('y-axis')
xlabel ('x-axis')
title('Graph of 2x^2-16x+28')
hold on;
fimplicit(@(x,y) 4*x.^2 +25*y.^2 - 32*x - 100*y+64)
hold off

Réponse acceptée

DGM
DGM le 26 Jan 2022
Modifié(e) : DGM le 26 Jan 2022
It's not being ignored; it's just so tiny that you can't see it. Change the domain over which you're plotting.
x = linspace(-1,9);
y = 2*x.^2-16*x+28;
plot(x,y)
hold on;
fimplicit(@(x,y) 4*x.^2 +25*y.^2 - 32*x - 100*y+64);
hold off
grid on
ylabel ('y-axis')
xlabel ('x-axis')
legend({'y = 2x^2 - 16x + 28','4x^2 + 25y^2 - 32x - 100y + 64 = 0'})
title('Look at my Graph')

Plus de réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by