A3.m:(adsbygoogle = window.adsbygoogle || []).push({});

%x = 0:pi/100:2*pi;

%y = sin(2*x);

%z = 2*cos(2*x);

%plot(x,y,'k',x,z,'--b')

%title('Plot of f(x)=sin(x) and it''s derivative')

%xlabel('X-axis')

%ylabel('Y-axis')

%legend('sin(2x)','2cos(2x)')

x = -2:0.01:2

y = f2(x)

plot(x,y)

f2.m:

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.

**Physics Forums - The Fusion of Science and Community**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

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?

Loading...

Similar Threads for Matlab Plotting function | Date |
---|---|

MATLAB Plotting a 3d function | Apr 1, 2016 |

Plotting an integral-defined function in MATLAB | Aug 5, 2015 |

MATLAB Matlab Code for solving and plotting function x'(t) = 1 + t*sin(t*x) | May 9, 2013 |

Matlab: what is the right 3D plotting function for my code? | Apr 22, 2013 |

[Matlab] Plotting two functions of the same variable against each other | Nov 15, 2012 |

**Physics Forums - The Fusion of Science and Community**