How do i plot this quadratic graph?

5 views (last 30 days)
Yaseen Noaman
Yaseen Noaman on 22 Nov 2020
Edited: Stephan on 23 Nov 2020
I'm trying to plot this quadratic graph. For some reason it looks like this. It's not crossing the x axis for some reason the x axis are down. I need to fix it please.
This is the graph and the code.
  2 Comments
Setsuna Yuuki.
Setsuna Yuuki. on 22 Nov 2020
that depends on the values of "a" "b" and "c", perhaps those values do not allow zero crossing.
Yaseen Noaman
Yaseen Noaman on 22 Nov 2020
They do. A is 1 b is -2 c is -4. They do cross the x axis

Sign in to comment.

Answers (1)

Stephan
Stephan on 23 Nov 2020
Edited: Stephan on 23 Nov 2020
x = -10:10;
y = polyval([1 -2 -4],x);
plot(x,y)
r = roots([1 -2 -4])
text(r(1),0,'\leftarrow Root')
text(r(2),0,'\leftarrow Root')

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!