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

1 visualización (últimos 30 días)
RADWAN A F ZEYADI
RADWAN A F ZEYADI el 16 de Oct. de 2021
Editada: Image Analyst el 18 de Oct. de 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.

Respuestas (1)

John D'Errico
John D'Errico el 16 de Oct. de 2021
Editada: John D'Errico el 16 de Oct. de 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.

Categorías

Más información sobre Multidimensional Arrays en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by