Passing audio file through a notch filter transfer function
이전 댓글 표시
I am looking to pass an audio signal through a notch filter to attenuate 1000Hz and 5000Hz frequencies. Here is my code:
[SigN, Fs] = audioread('\\ucofs\NoBackups\UCO VDI\Student Folder Redirection\nblair1\Desktop\Matlab1\RainFireNoise.wav');
Xs=fft(SigN);
L = length(Xs);
t = 0:1:length(Xs)-1;
k = 1;
f = 0:0.1:6000;
w = 2*pi*f;
wo = 2*pi*1000;
w2 = 2*pi*5000;
theta = 85*pi/180;
% zeros and poles for notch filter of frequencies 1000hz and 5000hz
z = [wo*1i; -wo*1i; w2*1i; -w2*1i];
p = [-wo*cos(theta)+wo*sin(theta)*1i; -wo*cos(theta)-wo*sin(theta)*1i; -w2*cos(theta)-w2*sin(theta)*1i; -w2*cos(theta)+w2*sin(theta)*1i];
[NumCof, DenCof] = zp2tf(z,p,k);
Hs = tf(NumCof, DenCof);
Ys = lsim(Hs, Xs, t);
plot(Fs/L*(0:L-1), abs(Ys));
xlim([0 6000]);
My thinking is that I can convert my audio file (SigN) to the laplace domain using the fft (Xs), and then pass it through my notch filter (Hs) using lsim. I know there are built in functions to do this but I'd like to do it using the input signal and transfer function.
The problem I am having is that Hs isnt affecting the frequency components at all and I am unsure why. I am also new to learning about this and am clueless. Any help would be appreciated, thanks.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Digital Filter Design에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
