Creating a BandPass Filter with Heaviside function

조회 수: 4 (최근 30일)
Ahmed Saleh
Ahmed Saleh 2020년 4월 15일
편집: Ahmed Saleh 2020년 4월 15일
I've searched all over the internet for a simple code for a BandPass Filter and i've found nothing, then I started to think and may have figured an easy solution, so can someone check if it's right or not ?
In my project I have a step where I create an ideal bandpass filter and I have to filter a voice signal with that Bandpass filter
The filter code is as shown
N=411248;
fs=48000;
Fvec=linspace(-fs/2,fs/2,N);
R1=heaviside(Fvec+3e3)-heaviside(Fvec+2e3);
R2=heaviside(Fvec-2e3)-heaviside(Fvec-3e3);
R=R1+R2;
plot(Fvec,R)
where N is my audio length
fs is the sample rate of the audio
here i'm making it double sided, if you don't want to you can delete R2 wich is the negative side
in R1 I have the bandwidth to start from 2 kHz to 3 kHz , you're supposed to edit it to your desired frequencies.
I need someone to check it because its simplicity makes me worried that it can be wrong

답변 (0개)

카테고리

Help CenterFile Exchange에서 Digital Filter Design에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by