?? appl6_2.m
字號(hào):
%Appl6_2
load kerl030916ud.txt
Fs=50; %采樣頻率
wp=1.5*2/Fs;ws=2.5*2/Fs; %根據(jù)采樣頻率將濾波器邊界頻率進(jìn)行轉(zhuǎn)換
Rp=1;Rs=30; %通帶波紋和阻帶衰減
Nn=128;
[N,Wn]=buttord(wp,ws,Rp,Rs); %求得濾波器的最小階數(shù)和截止頻率(歸一化頻率)
[b,a]=butter(N,Wn); %設(shè)計(jì)Butterworth低通數(shù)字濾波器
figure(1)
[H,f]=freqz(b,a,Nn,Fs); %用Nn點(diǎn)求得頻率特性
subplot(2,1,1),plot(f,20*log10(abs(H)));
xlabel('頻率/Hz');ylabel('振幅/dB');grid on;
subplot(2,1,2),plot(f,180/pi*unwrap(angle(H)))
xlabel('頻率/Hz');ylabel('相位/^o');grid on;
dt=1/Fs; %采樣間隔
x=kerl030916ud'; %輸入信號(hào)
t=[0:(length(x)-1)]*dt; %時(shí)間序列
figure(2)
subplot(2,1,1),plot(t,x); title('輸入信號(hào)') %繪制輸入信號(hào)
y=filter(b,a,x); %對(duì)輸入信號(hào)進(jìn)行濾波
subplot(2,1,2),plot(t,y),title('輸出信號(hào)') %繪制輸出信號(hào)
xlabel('時(shí)間/s')
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -