cheby1设计低通高通滤波器

设计一频率分分别为10hz和40hz的混合信号,分别通过低通和高通滤波器分离混合信号

fs=100;
x=0:1/fs:1;
tt=sin(20*pi*x+3)+4*sin(80*pi*x+3)+rands(1,length(x));
tt1=sin(20*pi*x+3);
tt2=4*sin(80*pi*x+3);

figure;
subplot(311);
plot(x,tt,'k-');
title('混合信号');
subplot(312);
plot(x,tt1,'k-');
title('f=10hz');
subplot(313);
plot(x,tt2,'k-');
title('f=40hz');

cheby1设计低通高通滤波器_第1张图片

滤波

%高通  通带频率要大于阻断频率
wp=40/length(x); rp=0.6;
ws=30/length(x);  rs=2;
[n,wn]=cheb1ord(wp,ws,rp,rs);

[b,a]=cheby1(n,rp,wn,'high');
y_gao=filter(b,a,tt);

%低通  通带频率要小于阻断频率
wp=40/length(x); rp=0.6;
ws=60/length(x);  rs=2;
[n,wn]=cheb1ord(wp,ws,rp,rs);

[b,a]=cheby1(n,rp,wn,'low');
y_di=filter(b,a,tt);

figure;
subplot(211);
plot(x,tt,'k-',x,y_gao,'r-');
legend('原始','高通')
subplot(212);
plot(x,tt,'k-',x,y_di,'r-');
legend('原始','低通')

cheby1设计低通高通滤波器_第2张图片
从 图上可以看出,分别滤波出原始10hz和40hz的信号

你可能感兴趣的:(matlab)