Cep Lab DSP
Cep Lab DSP
Cep Lab DSP
EEE-324
Lab Project
Class BEE(-6C)
Lab Assessment
Design a digital FIR low pass filter (with the following specifications):
(i) Plot the impulse response and provide a plot of the frequency
response of the designed filter
(ii) Chose an input signal of your choice (plot it as well) and show
filtered signal. Do this for both: first by adjusting frequency of input
signal within pass band and then adjusting it into stop band
(iii) show all the steps “how to perform part (ii)” using code composer
studio
Objective:
Introduction:
It removes high frequency signal components from the input using an FIR low pass filter. The
example demonstrates how to configure an FIR filter and then pass data through it in a block-
byblock fashion.
• In signal processing, a finite impulse response (FIR) filter is a filter whose impulse
response (or response to any finite length input) is of finite duration, because it settles to
zero in finite time. This contrasts with infinite impulse response (IIR) filters, which may
have internal feedback and may continue to respond indefinitely (usually decaying).
• The impulse response of an Nth-order discrete-time FIR filter lasts exactly N + 1
samples (from first nonzero element through last nonzero element) before it then settles
to zero.
• FIR filters can be:
Discrete time or digital
Continuous time or analog.
• The window design method is also advantageous for creating efficient half-band filters,
because the corresponding sinc function is zero at every other sample point (except the
center one).
• The product with the window function does not alter the zeros, so almost half of the
coefficients of the final impulse response are zero.
• An appropriate implementation of the FIR calculations can exploit that property to double
the filter's efficiency.
PASS BAND AND STOP BAND FILTERS:
A passband is the range of frequencies or wavelengths that can pass through a filter. For
example, a radio receiver contains a bandpass filter to select the frequency of the desired radio
signal out of all the radio waves picked up by its antenna. The passband of a receiver is the range
of frequencies it can receive when it is tuned into the desired frequency (channel).
A stopband is a band of frequencies, between specified limits, through which a circuit, such as a
filter or telephone circuit, does not allow signals to pass, or the attenuation is above the required
stopband attenuation level.
Code Composer Studio:
Code Composer Studio software is an integrated development environment (IDE) that supports
TI's microcontroller (MCU) and embedded processor portfolios. Code Composer Studio software
comprises a suite of tools used to develop and debug embedded applications. The software
includes an optimizing C/C++ compiler, source code editor, project build environment,
debugger, profiler and many other features. The intuitive IDE provides a single-user interface
that takes you through each step of the application development flow. Familiar tools and
interfaces let you get started faster than ever before. Code Composer Studio software combines
the advantages of the Eclipse software framework with advanced embedded-debug capabilities
from TI resulting in a compelling feature-rich development environment for embedded
developers.
Task 1:
Plot the impulse response and provide a plot of the frequency response of the
designed filter.
Code:
figure(); t=0:1:100;
y1=3*sin(0.18*pi.*t);
y2=3*sin(0.8*pi.*t);
x=filter(h,1,y1);
subplot(2,1,1)
stem(t,y1,'-')
legend('Original Signal')
subplot(2,1,2)
stem(t,x,'*')
legend('Filtered Signal')
figure(); t=0:1:100;
y1=3*sin(0.18*pi.*t);
y2=3*sin(0.8*pi.*t);
x=filter(h,1,y2);
subplot(2,1,1)
stem(t,y2,'-')
legend('Original Signal')
subplot(2,1,2)
stem(t,x,'*')
legend('Filtered Signal')
PLOT:
Figure 1
Figure 2
Figure 3
Task (ii):
Figure 4
Figure 5
Task (iii):
Show all the steps “how to perform part (ii)” using code composer studio?
CODE:
#include<stdio.h>; int
m,n,x[1000],h[1000],y[1000],i,j,k,x2[1000],a[1000];
void main()
scanf("%d",&m);
scanf("%d",&n);
for(i=0;i<m;i++)
scanf("%d",&x[i]);
if(m>n)
for(i-n;i<m;i++)
h[i]=0;
n=m;
for(i-m;i<n;i++)
{
x[i]=0;
m=n;}
} y[0]=0;
a[0]=h[0];
for(j-1;j<n;j++)
a[j]=h[n-j];
//Circular Convolution
for(i=0;i<n;i++)
y[0]+=x[i]*a[i];
for(k=1;k<n;k++)
y[k]=0;
//Circular Shift//
for(j=1;j<n;j++)
x2[j]=a[j-1];
x2[0]=a[n-1];
for(i=0;i<n;i++)
a[i]=x2[i]; y[k]+=x[i]*x2[i]
}}//Display Result
printf("Circular Convolution is\n");
for(i=0;i<n;i++)
printf("%d \t",y[i]);
In this Project we design a digital FIR low pass filter. This filter Removes high frequency signal
components from the input using an FIR lowpass filter. The example demonstrates how to configure an
FIR filter and then pass data through it in a block-by-block fashion.
FIR filters are widely used due to the powerful design algorithms that exist for them, their inherent
stability when implemented in non-recursive form, the ease with which one can attain linear phase, their
simple extensibility to multirate cases, and the ample hardware support that exists for them among other
reasons.
In task 1, the window method of FIR filter design (also called the Fourier series method) begins with our
deciding what frequency response we want for our low-pass filter. We can start by considering a
continuous low-pass filter, and simulating that filter with a digital filter. We'll define the continuous
frequency response H(f) to be ideal, i.e., a low-pass filter with unity gain at low frequencies and zero gain
(infinite attenuation) beyond some cutoff frequency.
In task 2, we adjust input signal within pass band and then adjusting it into stop band. A passband is the
range of frequencies or wavelengths that can pass through a filter. For example, a radio receiver
contains a bandpass filter to select the frequency of the desired radio signal out of all the radio waves
picked up by its antenna. The passband of a receiver is the range of frequencies it can receive when it is
tuned into the desired frequency (channel).
A stopband is a band of frequencies, between specified limits, through which a circuit, such as a filter or
telephone circuit, does not allow signals to pass, or the attenuation is above the required stopband
attenuation level.
In task 3, we just show all the steps “how to perform part (ii)” using code composer studio