MATLAB Answers

Matrix Dimensions must agree

조회 수: 1(최근 30일)
Erik Sanabria
Erik Sanabria 20 Aug 2014
답변: Ben11 20 Aug 2014
Here is a simple function I have to plot for a course in Matlab:
x = [0:0.01:10];
gx = 1-(2/x.^2);
plot(x,gx);
axis([-1,12,-1,12])
When I run it I get this error message:
Error using / Matrix dimensions must agree.
Please help!

  댓글 수: 0

로그인 to comment.

답변(1개)

Ben11
Ben11 20 Aug 2014
You're missing a "." in your division:
x = [0:0.01:10];
gx = 1-(2./x.^2);
plot(x,gx);
axis([-1,12,-1,12])

  댓글 수: 0

로그인 to comment.

이 질문에 답변하려면 로그인을(를) 수행하십시오.


Translated by