curious behavior of geomean
Mostra commenti meno recenti
I'm using matlab 2017a.
I've been having some trouble getting the expected output from geomean.
In debugging this, per the geomean documentation here https://www.mathworks.com/help/stats/geomean.html
i tried to run the following code
x = 1:10;
x(3) = nan; % Replace the third element of x with a NaN value
n = geomean(x,'omitnan')
And the expected response as mentioned in the documentation is n = 4.7408
In contrast, i get back
Error using size
Dimension argument must be a positive integer scalar within indexing range.
Error in geomean (line 26)
n = size(x,dim);
This seems like a pretty foundational problem if even this simple code example from the documentation is generating an error.
Any thoughts as to what might be going on here?
Risposta accettata
Più risposte (1)
Steven Lord
il 10 Nov 2020
1 voto
According to the Release Notes the ability to specify 'omitnan' to omit NaN values from the geometric mean calculations in geomean was introduced in release R2019a.
Categorie
Scopri di più su Logical in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!