채택된 답변

Massimo Zanetti
Massimo Zanetti 2016년 9월 28일

0 개 추천

Of course it gives you an error. In your script
x=0:0.01:6
is a vector of size 1x601. When you do elementwise multiplication
M=eye(3).*x;
you are trying to multiply a 3x3 matrix with a 1x601 vector, which is impossible.

댓글 수: 1

To obtain the graph of y=3x just do this:
x = 0:0.01:6;
y = 3*x;
plot(x,y);
You don't need to go through matrix multiplication in Matlab for elementwise multiplication of a vector (or a matrix) with a scalar.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Line Plots에 대해 자세히 알아보기

질문:

N/A
2016년 9월 28일

편집:

N/A
2016년 9월 28일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by