Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Plotting multiple polynomials in matlab

  1. Apr 2, 2010 #1
    Ok, I can plot a single polynomial easy enough such as 3*(x^2)-1 using fplot, but I want to graph multiple polynomials.

    When I try to use the plot it doesn't work even for one though. The graph is completely wrong.

    ie I make a new m-file.

    x = [-1:1];

    y = 3*x.^2 - 1;

    Then call the m-file in the command window.

    Then plot(x,y,'-b')

    But I get something resembling the absolute value of x instead :confused:
  2. jcsd
  3. Apr 5, 2010 #2
    There is only three points in your x vector! try a smaller step size.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook