# Plotting a parabola and an ellipse on the same graph

4 views (last 30 days)
Amber Porter on 26 Jan 2022
Commented: Amber Porter on 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

DGM on 26 Jan 2022
Edited: DGM on 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')
Amber Porter on 26 Jan 2022
Thank you!