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

[Matlab] Plotting a function inside a m-file?

  1. Oct 9, 2012 #1

    %x = 0:pi/100:2*pi;
    %y = sin(2*x);
    %z = 2*cos(2*x);
    %title('Plot of f(x)=sin(x) and it''s derivative')
    x = -2:0.01:2
    y = f2(x)


    function F = f2(x)
    F(1) = 2*(x(1)^4)-3*(x(1)^2)+x(1)-7;

    I ran A3.m but it doesn't seem to create a correct plot.
  2. jcsd
  3. Oct 10, 2012 #2
    Got my issue solved over at matlab central.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook