Akzeptierte Antwort

Massimo Zanetti
Massimo Zanetti am 28 Sep. 2016

0 Stimmen

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 Kommentar

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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Line Plots finden Sie in Hilfe-Center und File Exchange

Gefragt:

N/A
am 28 Sep. 2016

Bearbeitet:

N/A
am 28 Sep. 2016

Community Treasure Hunt

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

Start Hunting!

Translated by