smooth matlab三维,Matlab过滤器与SmoothData

本文探讨了在Matlab中使用filter和smoothdata函数进行数据平滑时的差异。通过示例代码展示,发现在特定设置下,这两个函数产生的结果不一致。文章提供了一个简单的示例,比较了两者在移动平均平滑处理上的输出,并讨论了可能的原因。
摘要由CSDN通过智能技术生成

我不知道为什么

filter

函数似乎输出了与

smoothdata

功能。它们都应该实现

5

使用平滑

移动平均

. 精通这些功能的人能解释发生了什么吗?

这是>

link

平滑数据

(对于额外的谜题,

smooth

功能,这也不一样):

% from documentation

t = linspace(-pi,pi,100);

rng default %initialize random number generator

x = sin(t) + 0.25*rand(size(t));

windowSize = 5;

b = (1/windowSize)*ones(1,windowSize);

a = 1;

y = filter(b,a,x);

%this is added for this example, you need >Matlab 2017a to run this

y2=smoothdata(x,'movmean',windowSize)

%y3=smooth(x,100); %bug in the code (obsolete)

y3=smooth(x,windowSize);

%now plot data

figure;

plot(t,x)

hold on

plot(t,y)

plot(t,y2)

plot(t,y3)

legend('Input Data&#

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值