How can i write this equation: d = obs + sqrt(alfa*​Cd^0.5)*ra​ndn(nd, ne)

1 Ansicht (letzte 30 Tage)
RADWAN A F ZEYADI
RADWAN A F ZEYADI am 16 Okt. 2021
Bearbeitet: Image Analyst am 18 Okt. 2021
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.

Antworten (1)

John D'Errico
John D'Errico am 16 Okt. 2021
Bearbeitet: John D'Errico am 16 Okt. 2021
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.

Kategorien

Mehr zu Multidimensional Arrays 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!

Translated by