Need help plotting simple graph in matlab

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
1 reply · 3K views
Fairy111
Messages
72
Reaction score
0

Homework Statement


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



Homework Equations





The Attempt at a Solution

 
Physics news on Phys.org
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.