Standard Deviation for X,Y data over 30 Years
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have 30 years of monthly average temperature for global latitude/longitude in a matrix A (dimensions Y,X,Year; size 361,721,30). I want to compute the standard deviation for each lat/long over the 30-year period so the resulting matrix should be size (361,721).
I've tried std(A,[],3) but the standard deviation isn't correct. Any thoughts on what I'm doing wrong or how to do this using the STD function?
2 comentarios
dpb
el 2 de Jul. de 2023
What makes you think the result of std is in error? I've never had it fail...sometimes there are ~isfinite() values or other bogus data that can fool you, but that's not the fault of std
Attach enough to show us what isn't what you think it should be; the obvious way would be to attach the .mat file of your data...
dpb
el 2 de Jul. de 2023
Editada: dpb
el 2 de Jul. de 2023
A=randi(100,5,5,5);
S1=std(A,[],3)
S2=std(A,0,3)
std(A(1,1,:))
v=squeeze([A(1,1,:)]);v=v-mean(v);
sqrt(dot(v,v)/(numel(v)-1))
sqrt(v.'*v/(numel(v)-1))
Shows it all seems to work as expected. I noticed the doc stated to use the 0 weight argumet explicitly so just checking that [] did as expected (sure it would) as well...
Respuestas (1)
the cyclist
el 2 de Jul. de 2023
std(A,[],3)
which seems to be equivalent to
std(A,0,3)
gives you normalization by N-1, which would typically what you want for sampled data. If instead you wanted normalization by N (typically for population data), then you can do
std(A,1,3)
instead. But I expect that is not the issue you mean.
0 comentarios
Ver también
Categorías
Más información sobre Calendar en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!