如何在 MATLAB 中有效找到相关性并丢弃 3-sigma 范围之外的点?
我有一个数据文件 m.txt
,看起来像这样(有更多点):
286.842995
3.444398
3.707202
338.227797
3.597597
283.740414
3.514729
3.512116
3.744235
3.365461
3.384880
一些值(如 338.227797
)是 与我通常期望的值(较小的数字)非常不同。
所以,我想 我将删除位于 3-sigma 范围之外的所有点。我怎样才能在 MATLAB 中做到这一点?
此外,更大的问题是该文件有一个与之关联的单独文件
t.txt
,该文件存储这些数字对应的时间值。因此,我还必须从t.txt
文件中删除相应的时间值。
我仍在学习 MATLAB,并且我知道有一些好的方法可以做到这一点(比存储从 m.txt
中删除的元素的索引,然后从 中删除这些元素更好) t.txt
文件)
I have a data file m.txt
that looks something like this (with a lot more points):
286.842995
3.444398
3.707202
338.227797
3.597597
283.740414
3.514729
3.512116
3.744235
3.365461
3.384880
Some of the values (like 338.227797
) are very different from the values I generally expect (smaller numbers).
So, I am thinking that
I will remove all the points that lie outside the3-sigma range
. How can I do that in MATLAB?Also, the bigger problem is that this file has a separate file
t.txt
associated with it which stores the corresponding time values for these numbers. So, I'll have to remove the corresponding time values from thet.txt
file also.
I am still learning MATLAB, and I know there would be some good way of doing this (better than storing indices of the elements that were removed from m.txt
and then removing those elements from the t.txt
file)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
@Amro 很接近,但 FIND 是不必要的(查找逻辑下标),并且您需要包含真正的 +/-3 sigma 范围的平均值。我会选择以下内容:
@Amro is close, but the FIND is unnecessary (look up logical subscripting) and you need to include the mean for a true +/-3 sigma range. I would go with the following: