資源簡(jiǎn)介
采用自帶的buttord 和butter函數(shù)實(shí)現(xiàn)對(duì)信號(hào)的低通濾波

代碼片段和文件信息
?
fp=500;fs=400?;%注:如果fp在fs區(qū)間內(nèi),則為帶通,反之為帶阻
?ap=2;as=30;
?fsa=4096;
?wp=fp/fsa*2;ws=fs/fsa*2;
[nwn]=buttord(wpwsapas);%濾波器階數(shù)選擇函數(shù),確定符合要求性能濾波器的最小階數(shù)和固有頻率
[BA]=butter(nwn);
[Hw]=freqz(BA);%?H為頻域傳遞函數(shù),w為所要計(jì)算相應(yīng)的頻率點(diǎn)組成的向量
figure(1);subplot(211);
length(w)
plot(w*fsa/(2*pi)abs(H));?????????????%繪制帶通頻譜圖
xlabel(‘Hz‘);ylabel(‘頻率響應(yīng)幅度‘);
title(‘低通濾波器‘);
grid;axis?tight;
subplot(212);plot(w*fsa/(2*pi)angle(H));
xlabel(‘Hz‘);ylabel(‘a(chǎn)ngel‘);
title(‘相位特性‘);
grid;axis?tight;
x=load(‘D:\debugging\matlabfiles\監(jiān)測(cè)診斷試驗(yàn)\數(shù)據(jù)\齒輪\19點(diǎn)20分14秒\通道1.txt‘);
figure(2)
subplot(211)
t=(0:length(x)-1)/fsa;
plot(tx);
xlabel(‘t‘);ylabel(‘x(t)‘);
title(‘濾波前連續(xù)信號(hào)‘);
grid;axis?tight;
y=filter(BAx);%時(shí)域?yàn)V波
figure(2)?
subplot(212);
plot(ty);
xlabel(‘t‘);ylabel(‘y(t)‘);
title(‘濾波后連續(xù)信號(hào)‘);
grid;axis?tight;
figure(3)
N=length(x);
X=fft(xN)/N;w=fsa/2*linspace(01N/2+1);
subplot(211);plot(wabs(X(1:N/2+1)));??%繪制頻譜圖
xlabel(‘Hz‘);ylabel(‘頻率響應(yīng)幅度‘);
title(‘濾波前頻譜圖‘);
grid;axis?tight;
Y=fft(yN)/N;w=fsa/2*linspace(01N/2+1);
subplot(212);plot(wabs(Y(1:N/2+1)));???????%繪制頻譜圖
xlabel(‘Hz‘);ylabel(‘頻率響應(yīng)幅度‘);
title(‘濾波后頻譜圖‘);
grid;axis?tight;
?
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-08-29?16:12??低通濾波器?matlab?實(shí)現(xiàn)\
?????文件??????????55??2018-08-27?11:33??低通濾波器?matlab?實(shí)現(xiàn)\【源碼使用必讀】.url
?????文件????????1338??2012-11-19?17:37??低通濾波器?matlab?實(shí)現(xiàn)\lowpass.m
?????文件??????237958??2012-11-19?17:50??低通濾波器?matlab?實(shí)現(xiàn)\帶通特性.bmp
?????文件??????237958??2012-11-19?17:45??低通濾波器?matlab?實(shí)現(xiàn)\低通濾波后.bmp
- 上一篇:行人航位推算算法PDR程序完整可用
- 下一篇:MIMO雷達(dá)BP算法
評(píng)論
共有 條評(píng)論