加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

matlab四阶butterworth滤波实例

(2017-04-29 18:26:57)
标签:

滤波

butterworth

分类: matlab
clear;clc;
fs=2000; %采样频率
T=1/fs;
L=500;
t=(0:L-1)*T;
y1=sin(2*pi*200*t);
y2=0.5*sin(2*pi*400*t);
y3=0.1*sin(2*pi*600*t);
y=y1+y2+y3;
%低通滤波器
fc=300;
wn=2*fc/fs;
[b,a]=butter(4,wn,'low');%构造butterworth低通滤波器,保留频率低于300Hz的振动
y_low=filter(b,a,y);
figure();plot(y_low,'r');hold on;plot(y1,'k')
xlabel('Time');ylabel('Amplitude')
matlab四阶butterworth滤波实例
%高通滤波器
fc=590;
wn=2*fc/fs;
[b,a]=butter(4,wn,'high');%保留频率高于590Hz的振动
y_high=filter(b,a,y);
figure();plot(y_high,'r');hold on;plot(y3,'k')
%带通滤波器
[b,a]=butter(4,[300*2/fs 590*2/fs]); %保留频率高于300低于590Hz的振动
yy=filter(b,a,y);
figure();plot(yy,'r');hold on;plot(y2,'k')

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有