0
votes

I have to design FIR Highpass Filter according to given Plot(Picture Attached). Using Rectangular and Kaiser Window with Different Cutoff Frequencies.

My Problem is that i am able to generate Stopband Riples with equal width but in given problem riple width attenuates with increase in frequency. Should I use command other than fir1 ?

Filter To be Designed Filter To be Designed

My Designed Filter Output My Designed Filter Output

Here is my Code so far.

clc;clear all; close all;
A=36;
N=30;
fs=48000;
fc=10000;
omega=2*fc/fs;
k=0:1:N;
beta=0.5842*((A-21)^0.4)+0.07886*(A-21)
kaiser_win=kaiser(N+1,beta);
b_fir1 = fir1(N,omega,'high',kaiser_win);
f = linspace(0,10000,10000); %frequency vector
H_fir1 = freqz(b_fir1,1,f,fs);

plot(f,db(abs(H_fir1)))
grid
xlabel('frequency in Hz'), ylabel('amplitude in dB')
%axis([0 10000 -60 6])
title('Window method (FIR)')
1
Welcome to Stack Overflow. You filled out a box which said "Ask a question". Question are denoted with question marks, ?, and can be answered. You forgot to ask a question here, and as such it's impossible to answer this. Please state a clear, answerable question. You might be interested in reading up on How to Ask on this site.Adriaan

1 Answers

0
votes

The good news is that your design is actually fine, but you are simply looking at it differently then the plot you are trying to reproduce, which plots the magnitude responses on a logarithmic frequency scale.

To obtain a similar plot, use semilogx like so:

semilogx(f(2:end),db(abs(H_fir1(2:end))))
grid
xlabel('frequency in Hz'), ylabel('amplitude in dB')
axis([10 20000 -60 6])

This should give you a graph that looks like:

enter image description here