How can I make my high pass filter more accurate?

3 views (last 30 days)
Hello everyone,
So, I am doing a project with a sound file of my voice and applying some filters to it and finding the fourier transforms.
My code (just a little part) is:
[y,Fs] = audioread('myvoice.m4a');
L = length(y);
f = Fs*(0:(L/2))/L; %frequency
y_HPF_270 = highpass(y,270,Fs);
%270Hz
%plot fourier transform of HPF
%set up
% Compute the two-sided spectrum P2. Then compute the single-sided spectrum P1 based on P2 and the even-valued signal length L.
P2_HPF270 = abs(yf_HPF_270/L);
P1_HPF270 = P2_HPF270(1:L/2+1);
P1_HPF270(2:end-1) = 2*P1_HPF270(2:end-1);
%plot
subplot(3,2,6);
plot(f,P1_HPF270)
title('Single-Sided Amplitude Spectrum of HPF 270Hz')
xlabel('f (Hz)')
ylabel('|P1(f)|')
From what I understand from High Pass filters is that i filters the frequencies that are below a cutoff frequency. If my cutoff frequency is 270 Hz, why do I get still frequencies below 270?
The fourier Transform graph taht I get is:
HPF_270Hz.JPG

Accepted Answer

Ridwan Alam
Ridwan Alam on 11 Dec 2019
Edited: Ridwan Alam on 11 Dec 2019
If my cutoff frequency is 270 Hz, why do I get still frequencies below 270?
Unless it's an ideal highpass filter, most filter implementations show a transition band where the attenuation starts to take effect. You can find more details here:
To get steeper response, try this:
highpass(y,270,Fs,'Steepness',0.99,'StopbandAttenuation',100)

More Answers (0)

Categories

Find more on Fourier Analysis and Filtering in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!