Plotting a parabola and an ellipse on the same graph

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

Risposta accettata

DGM
DGM il 26 Gen 2022
Modificato: DGM il 26 Gen 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')

Più risposte (0)

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