[問題] MATLAB濾波器的濾波使用已回收
請高手大大幫忙指導一下
我利用MATLAB 內建的FDAtool建立的濾波器
濾波階數為30階
取樣頻率為200kHz
3dB點 在30kHz
我建立了這個濾波器以後~想拿來濾掉我的訊號,但是我不知道該怎麼做,
下面我是利用課本學來的部分,利用filter來濾波,但是不知道參數該怎麼設定
或者有其他更好的方法,麻煩不吝指導!!感謝
以下是我的程式碼!!
close all;close all;
Fs = 200000; % Sampling Frequency
N = 30; % Order
Fpass = 26500; % Passband Frequency
Fstop = 53000; % Stopband Frequency
Wpass = 1; % Passband Weight
Wstop = 1; % Stopband Weight
dens = 20; % Density Factor
% Calculate the coefficients using the FIRPM function.
b = firpm(N, [0 Fpass Fstop Fs/2]/(Fs/2), [1 1 0 0], [Wpass Wstop], ...
{dens});
Hd = dfilt.dffir(b);
freqz(Hd)
t=0:10^(-7):10^(-3);
wtest=10000*2*pi;
one = sin(wtest*t);
ones= filter(b,1,one);
ta1=one/ones
two=sin(2*wtest*t);
twos= filter(b,1,two);
ta2=two/twos
three=sin(3*wtest*t);
threes= filter(b,1,three);
ta3=three/threes
four=sin(4*wtest*t);
fours= filter(b,1,four);
ta4=four/fours
five=sin(5*wtest*t);
fives= filter(b,1,five);
ta5=five/fives
six=sin(6*wtest*t);
sixs= filter(b,1,six);
ta6=six/sixs
figure(2)
subplot(211)
plot(t,one);title('10k濾波前訊號');
subplot(212)
plot(t,ones);title('10k濾波後訊號');
figure(3)
subplot(211)
plot(t,two);title('20k濾波前訊號');
subplot(212)
plot(t,twos);title('20k濾波後訊號');
figure(4)
subplot(211)
plot(t,three);title('30k濾波前訊號');
subplot(212)
plot(t,threes);title('30k濾波後訊號');
figure(5)
subplot(211)
plot(t,four);title('40k濾波前訊號');
subplot(212)
plot(t,fours);title('40k濾波後訊號');
figure(6)
subplot(211)
plot(t,five);title('50k濾波前訊號');
subplot(212)
plot(t,fives);title('50k濾波後訊號');
figure(7)
subplot(211)
plot(t,six);title('60k濾波前訊號');
subplot(212)
plot(t,sixs);title('60k濾波後訊號');
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.127.77.161
MATLAB 近期熱門文章
PTT數位生活區 即時熱門文章