filter matlab 滤波器

来源:百度知道 编辑:UC知道 时间:2024/06/09 11:18:02
clear
clc
% 无噪声复合信号
detat=0.0001;
t=0:detat:0.05;
s1=sin(2*pi*100*t);
s2=sin(2*pi*200*t);
s3=sin(2*pi*500*t);
x=s1+s2+s3;
subplot(3,2,1)
plot(x(1:length(t)-1))
title('Time domain signals')
grid
F=abs(fft(x));
fs=1/detat;
detaf=fs/(length(t)-1);
xc=0:detaf:fs;
subplot(3,2,2)
plot(xc(1:(length(xc)-1)/10),F(1:length(F)-1)/10)
title('Spectrum of the signals')
grid
%加性均匀分布随机噪声
n1=rand(1,length(t));
x1=x+n1;
subplot(3,2,3)
plot(x1(1:length(t)-1))
grid
ylabel('Amplitude')
F1=abs(fft(x1));subplot(3,2,4)
plot(xc(1:(length(xc)-1)/10),F1(1:length(F)-1)/10)
ylabel('Amplitude')
grid
%加性高斯白噪声
n2=randn(1,length(t));
x2=x+n2;
subplot(3,2,5)
plot(x2(1:length(t)-1))
xlabel('Time(0.1ms)')
grid
F2=abs(fft(x2));
subplot(3,2,6)
plot(xc(1:(length(xc)-1)/10),F2(1:lengt

里面根本就没有filter,不过呢,你这个程序中好几个画图都有问题,改为
plot(xc(1:(length(xc)-1)/10),F(1:(length(F)-1)/10));

这个毛病是说,没有给足filter函数所需的变量。
你这里面没有filter函数啊。