Using a logical matrix as size input for lognrnd
1 次查看(过去 30 天)
显示 更早的评论
I am attempting to add random variation to a matrix of calculated values. The problem Is that I am attempting to add the log-normal error to only certain values of the original matrix.
GeneratedCatch(Catch_Active) = Catch_pred(Catch_Active) .* lognrnd(0, log((x(939)*x(319))^2 + Catch_variance(Catch_Active) + 1) , Catch_Active);
Catch_pred, GeneratedCatch and Catch_variance are 137 x 11 double matrices Catch_Active is a 137 x 11 logical matrix
The lognrnd accepts logical matrix but stores it as a 1 x 1 cell. Is there some way to get it to recognize the logical matrix for use as dimensions?
0 个评论
采纳的回答
Walter Roberson
2012-6-15
Try
GeneratedCatch(Catch_Active) = Catch_pred(Catch_Active) .* lognrnd(0, log((x(939)*x(319))^2 + Catch_variance(Catch_Active) + 1) , nnz(Catch_Active), 1);
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Statistics and Machine Learning Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!