urgent. ı can not fix this error " Error using * Inner matrix dimensions must agree. " on this code
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
mu=[1 1]';
p=0;
sigma=[1 2*p;2*p 4];
x= mu+sigma.*randn(1000,2);
Antworten (2)
Image Analyst
am 17 Mär. 2016
sigma is 2x2. The randn() gives a 1000x2. And mu is a 2x1. So you can't multiply element-by-element when the size of ALL dimensions don't match up perfectly. And you can't add them either. I mean, how could you add a 2x1 to a 2x2 or to a 1000x2? You can't. You need to figure out better what you are trying to accomplish.
3 Kommentare
Walter Roberson
am 18 Mär. 2016
What does that N notation signify?
There is no indication there of what yi might be, only what y would be. If the two are intended to be the same, then you have the problem that the only way to do a matrix multiplication of a 2 x 2 matrix with a 1000 x 2 matrix is if the 1000 x 2 matrix is on the left rather than the right.
You should not be using ".*" for algebraic matrix multiplication: you should be using "*"
Image Analyst
am 18 Mär. 2016
I am not familiar with that notation either. I suggest you read prior to that page in the book to figure it out. Multiplying a 2x2 matrix by a list of N points/coordinates is like a rotation of the points in the 2-D plane about the origin, but I don't think that is what is intended here.
Walter Roberson
am 18 Mär. 2016
Why are you still pursuing this question? You said it was "urgent" over 15 hours ago. Nothing short of a natural disaster or a person on an operating table can remain "urgent" for 15 hours.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!