Digital Signal Processing Lab Record R20 (III ECE)
Digital Signal Processing Lab Record R20 (III ECE)
The department imparts quality technical education with professional competence, leadership
abilities and ethical values through effective teaching learning process.
Course Outcomes
After successful competition of the course, the student will be able to
1 A30435.1 Evaluate the DFT and IDFT of given signals using MATLAB.
2 A30435.2 Analyze various DFT algorithms and their applications.
3 A30435.3 Design IIR and FIR digital filters for the given specifications using MATLAB.
4 A30435.4 Apply the concepts of multirate signal processing using MATLAB.
5 A30435.5 Demonstrate real-time signal Processing applications with DSK kit
(TMS320C6713) and Code Composer Studio.
Objectives:
To generate various sequences such as Unit impulse, Unit step, Square, Saw
tooth, Triangular, Sinusoidal, Ramp, Sinc Function.
Apparatus:
Clc;
Clear all; close all;
t=-20: 1:20
%--------------------Unit Impulse---------------------%
x=[zeros(1,20), 1,zeros(1,20)] %generate Unit Impulse Signal
figure(1), stem(t,x); % plot the generated Unit Impulse Signal
xlabel('t'); ylabel('x(t)'); title('Unit impulse Signal');
%------------------ Unit Step signal------------------%
y=[zeros(1,20), 1,ones(1,20)]
%y=[zeros(1,20),ones(20,1)] %generate Unit Step Signal
figure(2); stem(t,y); %Plot the generated unit step signal
xlabel('t'); ylabel('x(t)'); title('Unit Step Signal');
fs = 1000;
t = 0:1/fs:1.5;
x = sawtooth(2*pi*50*t); %generate sawtooth signal
figure(8);stem(t,x); axis([0 0.2 -1 1]); %plot the generated sawtooth signal
xlabel('t'); ylabel('x(t)'); title('sawtooth Signal');
%----------------- square signal---------------------%
t=(0:0.01:10);
sq_wave=square(4*pi*t); %generate square signal
figure(9); stem(t,sq_wave); axis([0 5 -2 2]) %plot the generated square signal
xlabel('t'); ylabel('x(t)'); title('square signal');
%---------------------periodic triangle------------%
T=20;
x=linspace(0,5*T,1000);
y1=min(0.5,mod(x,T)/T);
y2=min(0.5,1-mod(x,T)/T);
figure(10),stem(x,y1+y2),grid on
xlabel('time')
ylabel('magnitude')
title('periodic triangle wave')
Expected Graphs:
----------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------
3. Which MATLAB command divides the graphic space into six parts and select 5th part?
----------------------------------------------------------------------------------------------------------------
Outcomes:
Experiment No.
Objectives:
Write a matlab program to perform and Compute DFT and IDFT of given discrete-time signal.
Apparatus:
Program:
clc;
close all;
clear all;
xn=input('Enter the sequence x(n)'); %Get the sequence from user
ln=length(xn); %find the length of the sequence
xk=zeros(1,ln); %initialize an array of same size as that of input sequence
ixk=zeros(1,ln); %initilise an array of same size as that of input sequence
%code block to find the DFT of the sequence %----------------------------------------------
-------------
for k=0:ln-1
for n=0:ln-1
xk(k+1)=xk(k+1)+(xn(n+1)*exp((-i)*2*pi*k*n/ln));
end
end
ylabel ('Amplitude');
xlabel ('Time Index');
title('IDFT sequence');
Expected Graphs:
----------------------------------------------------------------------------------------------------------------
4. What is the condition to apply DFT on a signals
----------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------
5. Write the applications of DFT
----------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------
Experiment No:
Objectives:
Apparatus:
Program (A):
X=[x,zeros(1,n)];
H=[h,zeros(1,m)];
for i=1:n+m-1
Y(i)=0;
for j=1:m
if(i-j+1>0)
Y(i)=Y(i)+X(j)*H(i-j+1);
else
end
end
end
% plot results
disp('Linear convolution of given sequences is….');
disp(Y);
figure;
subplot(3,1,1);
stem(x, '-b^');
xlabel('Time---n');
ylabel('Amplitude---x[n]');
title('Input Sequence x(n)');
grid on;
subplot(3,1,2);
stem(h, '-ms');
xlabel('Time---n');
ylabel('Amplitude---h[n]');
title('Impulse Sequence h(n)');
grid on;
subplot(3,1,3);
stem(Y, '-ro');
ylabel('Amplitude---Y[n]');
xlabel('Time--->n');
grid on;
title('Convolution of Two Signals without conv function');
Expected Graphs
Enter x: [1 2 3 4 5 6]
Enter h: [2 4 3 2 1 5]
Linear convolution of given sequences is….
2 8 17 28 40 57 60 47 37 31 30
Program (B):
clc;
clear all;
close all;
x=input ('Enter the input sequence :');
h=input ('Enter the impulse response :');
n1=length(x);
n2=length(h);
n3=max(n1,n2);
n4=n1-n2;
%========================================================
%Appending zeros if lengths of the sequences are not equal
if(n4>0)
h=[h,zeros(1,n4)];
else
x=[x,zeros(1,-n4)];
end
%========================================================
%========================================================
%Loop for circular convolution
for(n=1:n3)
y(n)=0;
for(i=1:n3)
j=n-i+1;
if(j<=0)
j=j+n3;
end
y(n)=y(n)+x(i)*h(j);
end
end
%=======================================================
disp('circ convolution of given sequences is….');
disp(y);
subplot(3, 1,1);
stem(x);
title('input sequence');
xlabel('time----->');
ylabel('amplitude------>');
subplot(3, 1,2);
stem(h);
Department of Electronics and Communication Engineering 13
DIGITAL SIGNAL PROCESSING LABORATORY
title('impulse response');
xlabel('time----->');
ylabel('amplitude------>');
subplot(3, 1,3);
stem(y);
xlabel('n----->');
ylabel('amplitude------>');
title('output sequence(circular convolution)');
Expected Graphs
_____________________________________________________________
_______________________________________________________________
_______________________________________________________________
______________________________________________________________
______________________________________________________________
Outcomes:
Experiment No.
Objectives:
Apparatus:
1. What is FFT?
----------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------
(A) Program:
Expected Graphs
X=
Columns 1 through 6
Columns 7 through 8
Program (B):
subplot(2,2,2);
stem(n,real(XK));
title('Real part of X(K)');
xlabel('n');
ylabel('Amplitude');
subplot(2,2,3);
stem(n,imag(XK));
title('Imag part of X(K)');
xlabel('n');
ylabel('Amplitude');
Expected Graphs
enter x[n]:[1 2 3 4 4 3 2 1]
4. What are the differences and similarities between DIF and DIT algorithms?
----------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------
Outcomes:
Experiment No.
Objectives:
To Write a Matlab program of FIR Low pass and high pass filter using rectangular, Hanning
Hamming, Blackman and Kaiser window.
Apparatus:
----------------------------------------------------------------------------------------------------------------
(A )Program:
%MATLAB program of FIR Low pass filter using Rectangular, Hanning, Hamming, Blackman
and Kaiser window
clc;
clear all;
close all;
wc=.5*pi;
N=25;
w=0:0.1:pi;
%% BLACKMAN WINDOW
b=fir1(N,wc/pi,blackman(N+1));
h=freqz(b,1,w);
subplot(3,2,1)
plot(w/pi,abs(h))
grid;xlabel('normalised frequency');
ylabel('magnitude in dB');
title('FIR LPF USING BLACKMAN WINDOW');
%% HAMMING WINDOW
b=fir1(N,wc/pi,hamming(N+1));
h=freqz(b,1,w);
subplot(3,2,2)
plot(w/pi,abs(h));
grid;
xlabel('normalised frequency');
ylabel('magnitude in dB');
title('FIR LPF USING HAMMING WINDOW');
%% HANNING WINDOW
b=fir1(N,wc/pi,hanning(N+1));
h=freqz(b,1,w); subplot(3,2,3)
plot(w/pi,abs(h));
grid;
xlabel('normalised frequency');
ylabel('magnitude in dB');
title('FIR LPF USING HANNING WINDOW');
%% KAISER WINDOW
b=fir1(N,wc/pi,kaiser(N+1,3.5));
h=freqz(b,1,w); subplot(3,2,4)
plot(w/pi,abs(h));
grid;
xlabel('normalised frequency');
ylabel('magnitude in dB');
title('FIR LPF USING KAISER WINDOW');
%% RECTANGULAR WINDOW
b=fir1(N,wc/pi,boxcar(N+1));
h=freqz(b,1,w);
subplot (3,2,5);
plot(w/pi,abs(h));
grid;xlabel('normalised frequency');
ylabel('magnitude in dB');
title('FIR LPF USING RECTANGULAR WINDOW');
Expected Graphs
Program (B)
if(rem(n,2)~=0)
n1=n;
n=n-1;
end
c=input('enter your choice of window function 1. rectangular 2. triangular 3.kaiser: \n
');
if(c==1)
y=rectwin(n1);
disp('Rectangular window filter response');
end
if (c==2)
y=triang(n1);
disp('Triangular window filter response');
end
if(c==3)
y=kaiser(n1,beta);
disp('kaiser window filter response');
end
%HPF
b=fir1(n,wp,'high',y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
plot(o/pi,m);
title('HPF');
ylabel('Gain in dB-->');
xlabel('(b) Normalized frequency-->');
Expected Graphs
Outcomes:
Experiment No.
Objectives:
(A) To Design a Butterworth High pass filter for the given specifications using Matlab
(B) To Design a Chebyshev-I High pass filter for the given specifications using Matlab
Apparatus:
1 Pre-Lab Questions:
_________________________________________________________________
__________________________________________________________________
__________________________________________________________________
Program (A):
% Program for design a Butterworth Highpass filter for the given specifications
clc;
clear all;
close all;
alphap=input('enter pass attenuation in db='); %passband attenuation in db
alphas=input('enter stopband attenuation in db='); % stopband attenuation in db
fp=input('enter passband frequency in hz='); % passband frequency in hz
fs=input('enter stopband frequency in hz='); % stopband frequency in hz
F=input('enter sampling frequency in hz='); % sampling frequency in hz
omp=2*fp/F; %frequency in radians
oms=2*fs/F; %to find cutoff frequency and order of the filter
[n,wn]=buttord(omp,oms,alphap,alphas); %system function of the filter
[b,a]=butter(n,wn,'high');
w=0:0.01:pi;
[h,om]=freqz(b,a,w,'whole');
m=20*log10(abs(h));
an=angle(h);
subplot(1,2,1);
plot(om/pi,m);
grid;
xlabel('normalised frequency');
ylabel('gain in db');
title('magnitude response');
subplot(1,2,2);
plot(om/pi,an);
grid;
xlabel('normalised frequency');
ylabel('phase in radians');
title('phase response');
disp(b);
disp(a);
Expected Graphs
Program (B)
% Program for design a chebyshev-1 Hihpass filter for the given specifications
clc;
clear all;
close all;
alphap=input('passband attenuation in db='); %passband attenuation in db
alphas=input('stopband attenuation in db=');% stopband attenuation in db
wp=.3*pi;% passband frequency in rad
ws=.2*pi;% stopband frequency in rad %order and cutoff frequency of the filter
[n,wn]=cheb1ord(wp/pi,ws/pi,alphap,alphas); %system function of the filter
[b,a]=cheby1(n,alphap,wn,'high');
w=0:0.01:pi;
[h,ph]=freqz(b,a,w);
m=20*log10(abs(h));
an=angle(h);
subplot(1,2,1);
plot(ph/pi,m);
grid;
xlabel('normalised frequency');
ylabel('gain in db');
title('magnitude response');
subplot(1,2,2);
plot(ph/pi,an);
grid;
xlabel('normalised frequency');
ylabel('phase in rad');
title('phase response');
disp(b);
disp(a);
Expected Graphs:
_______________________________________________________________
______________________________________________________________
Outcomes:
Experiment No.
Objectives:
Apparatus:
1 Pre-Lab Questions:
1. Define sampling.
_________________________________________________________________
__________________________________________________________________
3. Define Brightness.
__________________________________________________________________
Program (A)
clc;
clear all;
close all;
Expected Graphs
Program (B)
clc;
clear all;
close all;
L=input('Enter the upsampling factor');
N=input('Enter the length of the input signal'); % Length should be greater than 8
f1=input('Enter the frequency of first sinusodal');
f2=input('Enter the frequency of second sinusodal');
n=0:N-1;
x=sin(2*pi*f1*n)+sin(2*pi*f2*n);
y=interp(x,L);
subplot(2,1,1)
stem(n,x(1:N))
title('input sequence');
Department of Electronics and Communication Engineering 39
DIGITAL SIGNAL PROCESSING LABORATORY
xlabel('time(n)');
ylabel('amplitude');
subplot(2,1,2)
m=0:N*L-1;
stem(m,y(1:N*L))
title('Interpolation sequence ');
xlabel('time(n)');
ylabel('amplitude');
Expected Graphs
______________________________________________________________
______________________________________________________________
2 Define decimation?
____________________________________________________________
______________________________________________________________
_______________________________________________________________
____________________________________________________________
______________________________________________________________
Outcomes:
1 Performed Decimation & Interpolation for the given sequence using matlab.
2 Able to understand demiation process in multirate signal processing
PART-B
EXPERIMENTS
ON DSP
PROCESSOR
A signal can be defined as a function that conveys information, generally about the
state or behavior of a physical system. There are two basic types of signals viz Analog
(continuous time signals which are defined along a continuum of times) and Digital
(discrete-time).
Remarkably, under reasonable constraints, a continuous time signal can be adequately
represented by samples, obtaining discrete time signals. Thus digital signal processing
is an ideal choice for anyone who needs the performance advantage of digital
manipulation along with today’s analog reality. Hence a processor which is designed
to perform the special operations (digital manipulations) on the digital signal within
very less time can be called as a Digital signal processor. The difference between a
DSP processor, conventional microprocessor and a microcontroller are listed below.
DSP PROCESSORS: Such as Texas instruments and Analog Devices Contains CPU;
RAM; ROM; I/O ports and Timer.
Optimized for
o fast arithmetic
o Extended precision
o Dual operand fetch
o Zero overhead loop
o Circular buffering
A digital signal processor (DSP) is an integrated circuit designed for high-speed data
manipulations, and is used in audio, communications, image manipulation, and other
data-acquisition and data-control applications. The microprocessors used in personal
computers are optimized for tasks involving data movement and inequality testing.
The typical applications requiring such capabilities are word processing, database
management, spread sheets, etc. When it comes to mathematical computations the
traditional microprocessor are deficient particularly where real-time performance is
Feature Use
Fast-Multiply accumulate Most DSP algorithms, including filtering,
transforms, etc. are multiplication-
intensive
Multiple – access memory architecture Many data-intensive DSP operations
require reading a program instruction and
multiple data items during each
instruction cycle for best performance
Specialized addressing modes Efficient handling of data arrays and first-
in, first-out buffers in memory
Specialized program control Efficient control of loops for many
iterative DSP algorithms. Fast interrupt
handling for frequent I/O operations.
On-chip peripherals and I/O interfaces On-chip peripherals like A/D converters
allow for small low cost system designs.
Similarly I/O interfaces tailored for
common peripherals allow clean
interfaces to off-chip I/O devices.
TI‟s Code Composer Studio development tools are bundled with the 6713DSK
providing the user with an industrial-strength integrated development environment for
C and assembly programming. Code Composer Studio communicates with the DSP
using an on-board JTAG emulator through a USB interface. The TMS320C6713 DSP
is the heart of the system. It is a core member of Texas Instruments‟ C64X line of
fixed point DSPs whose distinguishing features are an extremely high performance
225MHz VLIW DSP core and 256Kbytes of internal memory. On-chip peripherals
include a 32-bit external memory interface (EMIF) with integrated SDRAM
controller, 2 multi-channel buffered serial ports (McBSPs), two on-board timers and
an enhanced DMA controller (EDMA). The 6713 represents the high end of TI‟s
C6700 floating point DSP line both in terms of computational performance and on-
chip resources.
The DSK has 4 light emitting diodes (LEDs) and 4 DIP switches that allow
users to interact with programs through simple LED displays and user input on the
switches. Many of the included examples make use of these user interfaces Options.
The DSK implements the logic necessary to tie board components together in
a programmable logic device called a CPLD. In addition to random glue logic, the
CPLD implements a set of 4 software programmable registers that can be used to
access the on-board LEDs and DIP switches as well as control the daughter card
interface.
AIC23 Codec:
The DSK uses a Texas Instruments AIC23 (part #TLV320AIC23) stereo codec for
input and output of audio signals. The codec samples analog signals on the
microphone or line inputs and converts them into digital data so it can be processed
by the DSP. When the DSP is finished with the data it uses the codec to convert the
samples back into analog signals on the line and headphone outputs so the user can
hear the output.
When you connect your DSK through USB for the first time on a Windows
Loaded PC the new hardware found wizard will come up. So, Install the drivers (The
CCS CD contains the require drivers for C6713 DSK).
STEP 1: Start CCS Setup by double clicking on the Setup CCS desktop icon.
STEP 2: Select Family ->c67xx Platform->simulator Endean’s->little
STEP 3: Click the Import button (File-> import) to import our selection
(c67xx_sim.ccs) to the System configuration currently being created in the
CCS Setup window.
STEP 4: Click the Save and Quit button to save the configuration in the System
Registry.
STEP 5: Click the Yes button to start the CCS IDE when we exit CCS Setup. The
CCS Setup Closes and the CCS IDE automatically opens using the
Configuration we just created.
STEP 3: Add files to our project (source file\ library file\ linker file)
SOURCE FILE: Add the source file in the project using ‘Project->add files to project’
pull down menu. Files of type: c/c++ source file (*.c*)
Path: C:\CCStudio_v3.1\ My Projects\Project Name\filename’s
LIBRARY FILE: Add the library file in the project using ‘Project-> add files to
project’ pull down menu. Files of type: Object and Library Files (*.o*,*.l*)
Path: C:\CCStudio_v3.1\ C6000\ cgtools\ lib \ rts6700.lib
LINKER FILE: Add the linker file in the project using ‘Project-> add files to project’
pull down menu. Files of type: Linker command Files (*.cmd*,*.lcf*)
Path: C:\CCStudio_v3.1\ tutorial\ dsk6713\ hello1 \ hello.cmd
STEP 4: Building and Running the Program (compile\ Build\ Load Program\
Run)
COMPILE: Compile the program using the ‘Project-compile’ pull down menu or by clicking
the shortcut icon on the left side of program window.
BUILD: Build the program using the ‘Project-Build’ pull down menu or by clicking the
shortcut icon on the left side of program window.
LOAD PROGRAM: Load the program in program memory of DSP chip using the ‘File-load
program’ pull down menu. Files of type:(*.out*)
Path: C:\CCStudio_v3.1\ MyProjects\Project Name\ Debug\ Projectame.out
RUN: Run the program using the ‘Debug->Run’ pull down menu or by clicking the shortcut
icon on the left side of program window.
STEP 5: observe output using graph Choose View-> Graph-> Time/Frequency. In The
Graph Property Dialog, Change The Graph Title, Start Address, And Acquisition Buffer Size,
Display Data Size, Dsp Data Type, Auto Scale, And Maximum Y- Value Properties To The
Values.
Experiment No.
Objectives:
Apparatus:
PROCEDURE:
1 Connect CRO to the LINE OUT socket.
2 Now switch ON the DSK and bring up Code Composer Studio on PC
3 Create a new project with name sinewave.pjt
4 From File menu->New->DSP/BIOS Configuration->Select dsk6713.cdb and save it
as “ sinewave.cdb”
5 Add sinewave.cdb to the current project
6 Create a new source file and save it as sinewave.c
7 Add the source file sinewave.c to the project
8 Add the library file “dsk6713bsl.lib” to the project ( Path:
C:\CCStudio\C6000\dsk6713\lib\dsk6713bsl.lib)
9 Copy files “dsk6713.h” and “dsk6713_aic23.h” to the Project folder (Path:
C:\CCStudio_v3.1\C6000\dsk6713\include)
10 Build (F7) and load the program to the DSP Chip ( File->Load Program(.out file))
11 Run the program (F5)
12 Observe the waveform that appears on the CRO screen and ccstudio simulator.
(A ) Program:
void main()
{
DSK6713_AIC23_CodecHandle hCodec;
DSK6713_init();
hCodec=DSK6713_AIC23_openCodec(0, &config);
DSK6713_AIC23_setFreq(hCodec, fs);
while(1)
{
outbuffer[i]=sine_table[loop];
while(!DSK6713_AIC23_write(hCodec, sine_table[loop])*gain);
i++;
if(i==BUFFERLENGTH) i=0;
if(++loop>47) loop=0;
}
}
Expected Graphs:
Outcomes:
Experiment No.
Implementation of Linear convolution & Circular
9 Convolution
Objectives:
Apparatus:
1 TMS320C6748DSK
2 PC with Code Composer Studio.
PROCEDURE:
1 Open Code Composer Setup and select C6713 simulator, click save
and quit
2 Start a new project using Project New pull down menu, save it in a separate
directory
3 (C:\My projects) with file name
linearconv.pjt
4 Create a new source file using File New Source file menu and save it in the
project folder (linearconv.c)
5 Add the source file (linearconv.c) to the project
6 Project Add files to Project Select linearconv.c
7 Add the linker command file
hello.cmd
8 Project Add files to Project
(path:C:\CCstudio\tutorial\dsk6713\hello\hello.md)
9 Add the run time support library file rts6700.lib
10 Project Add files to Project (Path: C\CCStudio\cgtools\lib\rts6700.lib)
11 Compile the program using project Compile menu or by Ctrl+F7
12 Build the program using project Build menu or by F7
(A ) Program:
#include<stdio.h>
int y[20];
main(){
int m=6; /*Length of i/p samples sequence*/
int n=6; /*Length of impulse response Coefficients */
int i=0,j;
int x[15]={1,2,3,4,5,6,0,0,0,0,0,0}; /*Input Signal Samples*/
int h[15]={1,2,3,4,5,6,0,0,0,0,0,0}; /*Impulse Response Coefficients*/
for(i=0;i<m+n-1;i++){
y[i]=0;
for(j=0;j<=i;j++)
y[i]+=x[j]*h[i-j];
}
for(i=0;i<m+n-1;i++)
printf("%d\n",y[i]);
}
Expected Graphs:
Buffer size :9
Start Address: y
Click :Ok
(B ) Program:
#include<stdio.h>
intm,n,x[30],h[30],y[30],i,j,temp[30],k,x2[30],a[30];
Void main (void ){
printf (“enter the length of the first sequence\n");
scanf ("%d", &m);
Printf (“enter the length of the second sequence\n");
scanf ("%d",&n);
Printf (“enter the first sequence\n");
for (i=0; i<m; i++)
scanf ("%d",&x[i]);
Printf (“enter the second sequence\n");
for (j=0; j<n;j++)
scanf ("%d", &h[j]);
if (m-n! =0) {
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++) /*folding h(n) to h(-n)*/
a[j]=h[n-j];
for (i=0; i<n; i++)
y[0]+=x[i]*a[i];
for (k=1; k<n; k++){
y[k] =0;
for (j=1; j<n;j++)
x2[j] =a [j-1];
x2[0] =a[n-1];
}
Printf (“the circular convolution is\n");
for (i=0; i<n;i++)
Printf ("%d \t", y[i]); }
Expected Graphs:
Experiment No.
Objectives:
Apparatus:
Program:
#include<stdio.h>
#include<math.h>
void main ()
{
short N=8;
short X[8]={1,2,3,4,4,3,2,1};//test data
float pi=3.1416;
float sumRe=0, sumlm=0;//init real/imag components
float cosine=0,sine=0;//initialize cosine/sine components
//output Real and imaginary components
float out_real[8]={0.0},out_imag[8]={0.0};
int n=0, k=0;
for(k=0;k<N;k++)
{
sumRe=0;
sumlm=0;
for(n=0;n<N;n++)
{
cosine=cos(2*pi*k*n/N);
sine=sin(2*pi*k*n/N);
sumRe=sumRe+X[n]*cosine;
sumlm=sumlm-X[n]*sine;
}
out_real[k]=sumRe;
out_imag[k]=sumlm;
printf("[%d]%7.3f%7.3f\n",k,out_real[k],out_imag[k]);
}
}
Expected Graphs:
Outcomes:
Experiment No.
Objectives:
Apparatus:
(A ) Program:
//iirfilters
#include<stdio.h>
#include<math.h>
intI,w,wc,c,N;
float H[100];
floatmul(float, int);
void main()
{
printf(“\n enter order of filter”);
scanf(“%d”,&N);
printf(“\n enter the cutoff freq”);
scanf(“%d”,&wc);
Department of Electronics and Communication Engineering 65
DIGITAL SIGNAL PROCESSING LABORATORY
Expected Graphs:
Objectives:
(B) Program:
#include<stdio.h>
#include<math.h>
#define pi 3.1415
int n,N,c;
float wr[64],wt[64];
void main()
{
printf("\n enter no. of samples,N= :");
scanf("%d",&N);
printf("\n enter choice of window function\n 1.rect \n 2. triang \n c= :");
scanf("%d",&c);
printf("\n elements of window function are:");
switch(c)
{
case 1:
for(n=0;n<=N-1;n++)
{
wr[n]=1;
printf(" \n wr[%d]=%f",n,wr[n]);
}
break;
case 2:
for(n=0;n<=N-1;n++)
{
wt[n]=1-(2*(float)n/(N-1));
printf("\n wt[%d]=%f",n,wt[n]);
}
break;
}
}
Expected Graphs:
Outcomes:
Experiment No.
Objectives:
Apparatus:
Programs:
#include "dsk6713.h"
#include "dsk6713_aic23.h"
#include "stdlib.h"
#include "math.h"
// Codec configuration settings
DSK6713_AIC23_Config config = { \
0x0017, /* 0 DSK6713_AIC23_LEFTINVOL Left line input channel volume */ \
0x0017, /* 1 DSK6713_AIC23_RIGHTINVOL Right line input channel volume */\
0x01F9, /* 2 DSK6713_AIC23_LEFTHPVOL Left channel headphone volume */ \
0x01F9, /* 3 DSK6713_AIC23_RIGHTHPVOL Right channel headphone volume */
\
0x0011, /* 4 DSK6713_AIC23_ANAPATH Analog audio path control */ \
0x0000, /* 5 DSK6713_AIC23_DIGPATH Digital audio path control */ \
0x0000, /* 6 DSK6713_AIC23_POWERDOWN Power down control */ \
Outcomes: