urgent. ı can not fix this error " Error using * Inner matrix dimensions must agree. " on this code
1 回表示 (過去 30 日間)
古いコメントを表示
mu=[1 1]';
p=0;
sigma=[1 2*p;2*p 4];
x= mu+sigma.*randn(1000,2);
回答 (2 件)
Image Analyst
2016 年 3 月 17 日
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 件のコメント
Walter Roberson
2016 年 3 月 18 日
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
2016 年 3 月 18 日
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
2016 年 3 月 18 日
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 件のコメント
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!