问题描述
我没有经验与MATLAB,所以遗憾的新手问题:
I'm inexperienced with MATLAB, so sorry for the newbie question:
我有一个大的载体(905350元),其存储一大堆在它的数据。
我有标准偏差和平均的,现在我要切出是高于/低于平均值的一个标准偏差的所有数据点。
我只是不知道如何。从我收集我必须作出某种形式的双回路?
I've got a large vector (905350 elements) storing a whole bunch of data in it.I have the standard deviation and mean, and now I want to cut out all the data points that are above/below one standard deviation from the mean.I just have no clue how. From what I gather I have to make a double loop of some sort?
这就像:平均-STD<数据我想<意味着+ STD。
It's like: mean-std < data i want < mean + std
推荐答案
如果数据在变量 A
,与存储在 meanA均值
并保存在 STDA
标准偏差,那么下面将提取您想同时保持数据值的原始顺序的数据:
If the data is in variable A
, with the mean stored in meanA
and the standard deviation stored in stdA
, then the following will extract the data you want while maintaining the original order of the data values:
B = A((A > meanA-stdA) & (A < meanA+stdA));
下面是对上面使用的概念触及一些有用的文档链接:logical运营商,。
Here are some helpful documentation links that touch on the concepts used above: logical operators, matrix indexing.
这篇关于超过1个标准差MATLAB排除数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!