1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Need help plotting simple graph in matlab

  1. Jan 2, 2010 #1
    1. The problem statement, all variables and given/known data
    I need to plot a graph in matlab,
    i typed in the following,
    V=[0:.2:20];
    I=(V^3)-(1.4*V)+0.9;
    plot(V,I)

    It comes up with the error,
    error using mpower, matrix must be square.

    Any help into how to fix this problem would be great.

    Thankyou



    2. Relevant equations



    3. The attempt at a solution
     
  2. jcsd
  3. Jan 2, 2010 #2

    Päällikkö

    User Avatar
    Homework Helper

    A^2 = A*A, i.e. a matrix multiplication. Use A.^2 for element-wise operations:

    V=[0:.2:20];
    I=(V.^3)-(1.4*V)+0.9;
    plot(V,I)

    Ought to work.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Need help plotting simple graph in matlab
  1. Simple MATLAB plot (Replies: 1)

Loading...