Why do I receive this message errorr ?
Ältere Kommentare anzeigen
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 Kommentare
RADWAN A F ZEYADI
am 8 Okt. 2021
Walter Roberson
am 8 Okt. 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
am 8 Okt. 2021
Walter Roberson
am 8 Okt. 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
am 8 Okt. 2021
Walter Roberson
am 10 Okt. 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)) )
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Linear Algebra finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!