Why do I receive this message errorr ?
Show older comments
Array dimensions must match for binary array op
this is the message error that i have obtained when i tried to perturb my data by this equation( Pert = obs + sqrt(alpha*Cd).*randn(nd, ne))
where obs=51*71*3 .,, alpha =0.25,, cd=71*71 ,,nd=51,ne=500 .
why do i recive this error ? thanks in advance
6 Comments
RADWAN A F ZEYADI
on 8 Oct 2021
Walter Roberson
on 8 Oct 2021
51 x 500 x 71 might be possible, depending on what multiplications are supposed to be of. However, obs is 51 x 71 x 3 and it is not at all clear where the x 3 should go.
RADWAN A F ZEYADI
on 8 Oct 2021
Walter Roberson
on 8 Oct 2021
Could the randn(51,500) be randn(71,500) instead?
If so then obs [51 x 71] * sqrt(alpha*Cd) [71 x 71] * randn [71 x 500] could give a 51 x 500 result that involved all of the arrays.
But if you are asking to add something to obs [51 x 71 x 3] then you are not going to be able to get a 51 x 500 x 3 result.
RADWAN A F ZEYADI
on 8 Oct 2021
Walter Roberson
on 10 Oct 2021
No. It is simply impossible to do what you want. You are trying to take a 51 x 71 x 3 array and add something to it to get a 51 x 500 x 3 result.
pagemtimes( obs, sqrt(alpha*Cd) * randn(71,500))
would get you a 51 x 500 x 3 result -- but it is not clear that is the formula that you would want, as it is pure multiplication with no addition. Also, potentially you might be wanting
pagemtimes( obs, pagemtimes(sqrt(alpha*Cd), randn(71,500,3)) )
Accepted Answer
More Answers (0)
Categories
Find more on Linear Algebra in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!