Creating a BandPass Filter with Heaviside function

3 Ansichten (letzte 30 Tage)
Ahmed Saleh
Ahmed Saleh am 15 Apr. 2020
Bearbeitet: Ahmed Saleh am 15 Apr. 2020
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

Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by