0% found this document useful (0 votes)
26 views12 pages

IIR Elliptic Band Pass Filter Design

The document describes designing FIR filters including low pass, high pass, band pass, and band stop filters using the Hamming window in MATLAB. It provides the theory behind FIR filter design such as specifying the filter parameters, selecting a window function, determining the filter length, and computing the filter coefficients. The MATLAB code generates the four different types of FIR filters based on given specifications, calculates the filter coefficients using the Hamming window, and plots the magnitude response of each designed filter to analyze the results.

Uploaded by

rahul273gaming
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views12 pages

IIR Elliptic Band Pass Filter Design

The document describes designing FIR filters including low pass, high pass, band pass, and band stop filters using the Hamming window in MATLAB. It provides the theory behind FIR filter design such as specifying the filter parameters, selecting a window function, determining the filter length, and computing the filter coefficients. The MATLAB code generates the four different types of FIR filters based on given specifications, calculates the filter coefficients using the Hamming window, and plots the magnitude response of each designed filter to analyze the results.

Uploaded by

rahul273gaming
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Expt. No.

: 3A
Name: Kshitij Shallesh Tater Date: 11/06/23
Slot: L39+L40
Register Number: 21BEE0094

Design of IIR Elliptical


Band Pass Filter

AIM:

Design an IIR Elliptic band pass filter to filter out noise from the sinusoidal signal using
MATLAB. Assume appropriate specifications. Plot the spectra. Comment on the results.

APPARATUS REQUIRED:

System with MATLAB R2022b.

THEORY

IIR ELLIPTICAL BAND PASS FILTER:

An elliptical bandpass filter, also known as an elliptic filter or Cauer filter, is a type of infinite
impulse response (IIR) filter commonly used in signal processing and telecommunications. It is
designed to allow a specific range of frequencies to pass through while attenuating frequencies
outside the passband.

The elliptical filter has a unique frequency response characteristic that exhibits ripples in both
the passband and stopband. This allows for a sharper transition between the passband and
stopband compared to other types of filters, such as Butterworth or Chebyshev filters. The
elliptical filter can achieve a steeper roll-off and a more compact filter design.

To design an elliptical bandpass filter, you need to specify certain parameters:

Passband frequencies: These define the range of frequencies that should pass through the filter
without significant attenuation.

Stopband frequencies: These define the range of frequencies that should be attenuated to a
certain level.

Passband ripple: It specifies the allowable variation in gain within the passband. This ripple is
typically specified in decibels (dB).
Stopband attenuation: It specifies how much the filter should attenuate frequencies in the
stopband. This attenuation is also specified in decibels (dB).

ALGORITHM:

1. Get the number of samples.

2. Generate the output sequence of the given two input signals.

3. Plot the graph.

MATLAB PROGRAM:

IIR ELLIPTICAL BAND

PASS FILTER

%Design of IIR Band Pass Elliptical filter


%Specifications: Order N=4;Passband ripple: alpha p = 0.1dB
%Stop band attenuation: alpha s=40dB;cutoff freq : fcl=15Hz
%Sampling frequency fs = 150Hz
% Kshitij Shallesh Tater 21BEE0094

clc;
clear all;
close all;
t=0:200;
fs=150; % sampling frequency
s1=sin(2*pi*10*t/fs); %10Hz signal
subplot(4,1,1);
plot(s1);
title('s1-10Hz signal');

s2=sin(2*pi*20*t/fs); %20Hz signal


subplot(4,1,2);
plot(s2);
title("s2-20Hz signal");

s3=sin(2*pi*40*t/fs); %40Hz signal


subplot(4,1,3);
plot(s3);
title("s3-40Hz signal");

s4=sin(2*pi*50*t/fs); %50Hz signal


subplot(4,1,4);
plot(s4);
title("s4-50Hz signal");
s=s1+s2+s3+s4; %sum of the signals
figure(2);
plot(s);

%Y = FILTER(B,A,X) One dimensional digital filter


%[B,A] = ELLIP(N,Rp,Rs,Wp,'low') % IIR Elliptical low pass filter
%Wp = [W1 W2]:[B,A] = ELLIP(N,Rp,Rs,Wp,'stop') % IIR Elliptical high pass filter

[b,a]=ellip(4,0.1,40,[15 45]*2/fs); % IIR Elliptical band pass filter


[h,w]=freqz(b,a,512);

figure(3);
plot(w*fs/(2*pi), abs(h));
title("Response of the filter");
xlabel('Frequency(Hz)');
ylabel('Gain(dB)');

sf = filter(b,a,s);
figure(4);
subplot(2,1,1);
plot(sf);
title("Filtered output");
xlabel("Time");
ylabel("Amplitude");

s = fft(s,512);
sf = fft(sf,512);
% p=(0:255)/256*(fs/2);
p=(0:511)/(512*(fs));
% p1=(0:255)/256*(fs/2);
subplot(2,1,2);
plot(p,abs([s(1:512)' sf(1:512)']));
%plot(p,abs([s(1:256)']));
%plot(p,abs([s(1:512)']));
title("Frequency spectrum of the filtered signal");
xlabel("Frequency (Hz)");
ylabel("PSD-Power Spectral Density");

RESULT:

Design an IIR Elliptic band pass filter to filter out noise from the sinusoidal signal are
successfully generated using Matlab code.
INFERENCE:

Filter selection: Based on the experiment's requirements, the researcher can choose the elliptical
bandpass filter as the filter of choice. This decision would be influenced by the desired
characteristics of the filter, such as the sharpness of the transition region, passband ripple, and
stopband attenuation.

Filter design: The parameters of the elliptical bandpass filter need to be determined to achieve
the desired filtering characteristics. The passband frequencies, stopband frequencies, passband
ripple, and stopband attenuation should be carefully defined based on the experiment's
requirements.

Implementation: Once the filter design parameters are determined, they can be used to calculate
the filter coefficients or pole-zero placements required for implementing the elliptical bandpass
filter. This implementation can be done using digital signal processing techniques or analog
circuitry, depending on the specific experiment setup.

Signal processing: The designed and implemented elliptical bandpass filter can be applied to the
experimental data to selectively pass the desired frequency range while attenuating unwanted
frequencies. This filtering process helps to isolate and analyze specific components of the signal
relevant to the experiment.

Data analysis: The filtered data can then be further analyzed and processed to draw inferences
and conclusions based on the experiment's objectives. The filtered signal may reveal patterns,
features, or specific frequency components that are of interest for the experiment.

REFERENCES:

Matlab help.

OUTPUT:
Register Number: 21BEE0094 Expt. No.:3B
Name: Kshitij Shallesh Tater
Date:11/06/23
Slot:L39+L40

DESIGN OF FIR FILTER

AIM:

Design a FIR LPF, HPF, BPF and BSF using Hamming window. Estimate the filter
coefficients using MATLAB. Assume appropriate specifications. Plot the spectra and
comment on the results.

APPARATUS REQUIRED:

System with MATLAB R2022b.

THEORY:

The design of a Finite Impulse Response (FIR) filter involves determining the filter coefficients
that define its frequency response. FIR filters are widely used in digital signal processing due to
their linear phase characteristics and ease of implementation.

Here are the basic steps involved in designing an FIR filter:

Filter Specifications: Define the specifications of the FIR filter based on your requirements.
These specifications typically include the desired frequency response characteristics, such as
passband ripple, stopband attenuation, and transition bandwidth. You may also specify the filter
order, which determines the number of coefficients in the filter.
Select a Window Function: Choose a window function that will shape the impulse response of
the FIR filter. Commonly used window functions include Hamming, Hann (or Hanning),
Blackman, and Kaiser. The choice of window function depends on the desired trade-off between
the main lobe width and the level of sidelobe attenuation.
Determine Filter Length: Determine the length of the FIR filter, which is equal to the number
of coefficients. The filter length is usually determined based on the desired frequency resolution
and the characteristics of the window function. A longer filter length generally provides better
frequency resolution but increases computational complexity.
Compute Ideal Frequency Response: Calculate the desired ideal frequency response for the
FIR filter based on the specified filter specifications. This can be done using mathematical
formulas or filter design tools.
Apply Windowing: Multiply the ideal frequency response by the chosen window function to
obtain the windowed frequency response. This process narrows the main lobe and reduces the
sidelobe levels.
Inverse Fourier Transform: Apply an inverse Fourier transform to the windowed frequency
response to obtain the time-domain impulse response of the filter.
Normalize and Quantize: Normalize the filter coefficients to ensure the maximum amplitude
does not exceed 1. If required, quantize the coefficients to the desired number of bits for
implementation.
Filter Implementation: Implement the designed FIR filter using the computed filter
coefficients. The implementation can be in software, hardware (e.g., FPGA or ASIC), or
dedicated DSP processors.

ALGORITHM:

1. Get the number of samples.

2. Generate the output sequence of the given two input signals.

3. Plot the graph.

MATLAB PROGRAM:

%program for FIR filter design using hamming window LPF,HPF,BPF,BSF


%Kshitij Shallesh Tater 21BEE0094

clc;
clear all;
close all;

rp=0.02;
rs=0.01;
fpb=1200;
fsb=1700;
fs=9000;
wp=2*fpb/fs;
ws=2*fsb/fs;
num=-20*log10(sqrt(rp*rs))-13;
den=14.6*(fsb-fpb)/fs;
n=ceil(num/den);
n1=n+1;
if (rem(n,2)~=0)
n1=n;
n=n-1;
end
y=hamming(n1);
%LOW PASS EILTER
b=fir1(n,wp,y);
[h,o]=freqz(b,1,256);
m=20*log10 (abs (h) );
subplot (2,2,1);
plot (o/pi,m);
ylabel ('Gain(dB)');
xlabel (' (a)Normalized frequency --- >');
title ('Magnitude response of FIR lo₩ pass filter');
%HIGH PASS FILTER
b=fir1(n,wp,'high',y);
[h,o]=freqz(b,1,256);
m=20*log10 (abs(h) );
subplot (2,2,2);
plot (o/pi,m, 'g');
ylabel ('Gain (dB)');
xlabel (' (b)Normalized frequency --- >');
% BAND PASS FILTER
wn=[wp,ws];
b=fir1(n, wn,y);
[h,o]=freqz (b,1,256);
m=20*log10 (abs (h));
subplot (2,2,3);
plot (o/pi,m,'r');
ylabel ('Gain (dB)');
xlabel (' (c)Normalized frequency --- >');
title('Magnitude response of FIR band pass filter');
%BAND STOP FILTER
b=-fir1(n,wn,'stop',y);
[h,o]=freqz(b, 1,256);
m=20*log10 (abs (h));
subplot (2,2,4);
plot (o/pi,m);
ylabel ('Gain (dB)');
%BAND STOP FILTER
b=fir1 (n,wn, 'stop',y);
[h, o]=freqz(b, 1,256);
m=20*log10 (abs (h));
subplot (2,2,4);
plot (o/pi,m);
ylabel ('Gain(dB)');
xlabel (' (d)Normalized frequency --- >');
title('Magnitude response of FIR band stop filter');
%Examрle
%Enter the pass band ripple-0.02 (bcozpap-rs]
%Enter the stop band ripple=0.01
% Enter the pass band frequency=1200
% Enter the stop band frequency-1700
% Enter the sampling frequency-9000

RESULT:

Design a FIR LPF, HPF, BPF and BSF using Hamming window are successfully generated using
Matlab code.

INFERENCE:

Experimental requirements: Determine the specific requirements of the experiment in terms of


signal processing. This includes identifying the desired frequency response characteristics, such
as the desired passband, stopband, and transition bandwidth, as well as any constraints on
passband ripple and stopband attenuation.

Filter design: Based on the experimental requirements, design an FIR filter that can meet these
specifications. The filter design process involves selecting an appropriate window function and
determining the filter length (number of coefficients) to achieve the desired trade-off between
frequency resolution and computational complexity.

Frequency response shaping: By designing the FIR filter, you can shape its frequency response
to emphasize or attenuate specific frequency components in the input signal. This can be useful
for isolating or enhancing certain features of the signal that are relevant to the experiment.

Windowing: Applying a window function to the desired frequency response narrows the main
lobe and reduces the levels of sidelobes. This step helps to minimize unwanted effects, such as
spectral leakage or distortion, that can impact the accuracy and reliability of the experimental
results.

Implementation: Once the filter coefficients are obtained, the FIR filter can be implemented in
software or hardware based on the specific experiment setup. The implementation involves
applying the filter coefficients to the input signal to perform the desired signal processing
operation, such as filtering out noise or extracting specific frequency components.

REFERENCES:

Matlab help.

OUTPUT:

Common questions

Powered by AI

An FIR filter differs from an IIR filter primarily in terms of implementation and application. FIR filters have finite impulse responses, provide inherently stable designs, and maintain linear phase characteristics. This makes them suitable for applications where phase linearity is crucial. On the other hand, IIR filters have infinite impulse responses, can achieve sharper frequency cut-offs with fewer coefficients, and are generally more computationally efficient for a given specification. However, they may exhibit non-linear phase and require careful design to ensure stability .

MATLAB facilitates the design and analysis of filters by providing tools and functions to easily calculate filter coefficients, simulate frequency responses, and visualize the effects of applied filters on signals. For instance, MATLAB's built-in functions, such as 'ellip' for elliptical filters or 'fir1' for FIR filters, enable the synthesis of complex filters with precise specifications. Additionally, plotting capabilities allow users to visualize both the time-domain and frequency-domain effects, enhancing the understanding and evaluation of the filter's performance on data .

The practical steps involved in implementing a designed filter on hardware include calculating the filter coefficients, normalizing, and possibly quantizing these coefficients based on the desired bit width for digital implementation. In hardware contexts such as FPGAs or DSP processors, these coefficients are then applied to input signals to perform tasks like noise reduction or frequency component extraction. This process may involve using development environments to program the filter logic into the hardware, testing for correct performance, and optimizing for power or speed considerations .

The selection of the window function in the design of an FIR filter using the window method is significant because it affects the frequency response characteristics of the filter, particularly the trade-off between main lobe width and sidelobe attenuation. The main lobe width is associated with the resolution of the filter, whereas sidelobes can cause unwanted spectral leakage. Different window functions, such as Hamming, Hann, Blackman, or Kaiser, offer unique set-offs between these factors, thus carefully selecting the window function based on the experiment's requirements is crucial for ensuring accurate and reliable filter performance .

Applying a window function in FIR filter design mitigates spectral leakage by reducing the level of sidelobes in the frequency response. Spectral leakage occurs when sharp transitions in the time domain—such as those occurring at the edges of a sampled signal—result in broadening in the frequency domain. A window function smooths these transitions, narrowing the main lobe and suppressing the sidelobe levels, thus minimizing the leakage that can distort the desired signal processing outcomes .

A researcher might choose an IIR Elliptical bandpass filter for its sharp transition between passband and stopband, enabling it to effectively isolate frequency components of interest while minimizing unwanted frequencies. This feature, combined with the ability to control passband ripple and stopband attenuation, allows for precise filtering in experiments that require strict frequency specifications and compact filter design, as described in the document .

When determining the filter length in FIR filter design, the primary trade-offs involve frequency resolution and computational complexity. A longer filter length generally improves frequency resolution by providing narrower transition bands, which allows for more precise frequency discrimination. However, it also increases the computational load and the time required for real-time processing. Thus, designers must balance these aspects based on the application's performance requirements and available computational resources .

An IIR Elliptic bandpass filter, also known as a Cauer filter, is distinguished by its frequency response characteristics, which include ripples in both the passband and stopband. This feature allows it to have a sharper transition between the passband and stopband compared to Butterworth or Chebyshev filters. The elliptic filter achieves a steeper roll-off and more compact design, making it preferable for applications requiring precise filtering .

When designing an IIR Elliptical bandpass filter, the essential parameters to specify include passband frequencies, stopband frequencies, passband ripple, and stopband attenuation. The passband and stopband frequencies determine the range of frequencies that will pass through or be attenuated, respectively. Passband ripple indicates the allowable gain variation within the passband, while stopband attenuation specifies the level of attenuation in the stopband. These parameters are crucial as they define the filter's performance in meeting specific filtering requirements .

Careful definition of passband ripple and stopband attenuation is crucial when designing a bandpass filter because these parameters directly impact the filter's ability to discriminate between desired and undesired frequencies. Passband ripple affects the uniformity of the gain in the passband, influencing the distortion of the output signal amplitude. Stopband attenuation determines how effectively unwanted frequencies are suppressed. Accurate speciation ensures that the filter meets the system's performance requirements, maintaining signal integrity and ensuring the accuracy of subsequent analyses or processing .

You might also like