How can i write this equation: d = obs + sqrt(alfa*Cd^0.5)*randn(nd, ne)
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi everyone
I have a problem with this equation in MATLAB:
d = obs + sqrt(alfa*Cd^0.5)*randn(nd, ne);
% where the diminsion of
obs= 51*71*3
alfa=0.002
Cd=71*71
nd=51
ne=500
I got this message error:
Array dimensions must match for binary array op.
How can I fix it? Or does it seem impossible?
Thank you.
댓글 수: 0
답변 (1개)
John D'Errico
2021년 10월 16일
편집: John D'Errico
2021년 10월 16일
Do I understand you correctly? obs is an array of size 51x71x3? Or is it a vector of that length? Regardless...
alfa is a scalar.
Cd is a scalar. Or is Cd a array of size 71 bt 71?
randn(nd,ne) produces an array of size ndxne, where nd is 51, and ne is 500.
And that means you want to add an array of size 51x71x3 to an array of size 51x500. I'm sorry, but that makes absolutely no sense at all. What do you expect to have as a result? Even if Cd is an array of size 71 by 71, things still do not match in size.
The error message indicates that these arrays cannot be added to each other, and that makes complete sense.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!