Using a logical matrix as size input for lognrnd
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Walter Roberson
le 15 Juin 2012
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);
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Statistics and Machine Learning Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!