DSP Lab .Final
DSP Lab .Final
LABORATORY MANUAL
III – B. Tech., II-Semester ECE
Index
GENERAL INSTRUCTIONS:
Test the USB port by running DSK Port test from the start menu
hello.cmd:
Compile:
To Compile: Project Compile project
To Build: Project build project,
To Rebuild: Project rebuild,
Bus Structure
The C67xx DSP architecture is built around eight major 16-bit buses (four program/data
buses and four address buses):
_ The program bus (PB) carries the instruction code and immediate operands from program
memory.
_ Three data buses (CB, DB, and EB) interconnect to various elements, such as the CPU, data
address generation logic, program address generation logic, on-chip peripherals, and data
memory.
_ The CB and DB carry the operands that are read from data memory.
_ The EB carries the data to be written to memory.
_ Four address buses (PAB, CAB, DAB, and EAB) carry the addresses needed for
instruction execution.
Department of Electronics & Communication 9
Engineering
UCE, AKNU DIGITAL SIGNAL PROCESSING LAB
The C67xx DSP can generate up to two data-memory addresses per cycle using the two
auxiliary register arithmetic units (ARAU0 and ARAU1). The PB can carry data operands
stored in program space (for instance, a coefficient table) to the multiplier and adder for
multiply/accumulate operations or to a destination in data space for data move
instructions (MVPD and READA). This capability, in conjunction with the feature of dual-
operand read, supports the execution of single- cycle, 3-operand instructions such as the
FIRS instruction. The C67xx DSP also has an on-chip bidirectional bus for accessing on-
chip peripherals. This bus is connected to DB and EB through the bus exchanger in the
CPU interface. Accesses that use this bus can require two or more cycles for reads and
writes, depending on the peripheral’s structure.
Central Processing Unit (CPU)
The CPU is common to all C67xE devices. The C67x CPU contains:
Barrel Shifter
The C67x DSP barrel shifter has a 40-bit input connected to the accumulators or to data
memory (using CB or DB), and a 40-bit output connected to the ALU or to data memory
(using EB). The barrel shifter can produce a left shift of 0 to 31 bits and a right shift of 0
to 16 bits on the input data. The shift requirements are defined in the shift count field of
the instruction, the shift count field (ASM) of status register ST1, or in temporary register
T (when it is designated as a shift count register). The barrel shifter and the exponent
encoder normalize the values in an accumulator in a single cycle. The LSBs of the output
are filled with 0s, and the MSBs can be either zero filled or sign extended, depending on
the state of the sign-extension mode bit (SXM) in ST1. Additional shift capabilities enable
the processor to perform numerical scaling, bit extraction, extended arithmetic, and
overflow prevention operations.
Multiplier/Adder Unit
These are the some of the important parts of the processor and you are instructed to go
through the detailed architecture once which helps you in developing the optimized code
for the required application.
VIVA QUESTIONS
EXPERIMENT-2:
VERIFICATION OF LINEAR CONVOLUTION USING MATLAB AND CC STUDIO
EQUIPMENT REQUIRED:
THEORY:
In this equation, x1(k), x2(n-k) and y(n) represent the input to and output from the system
at time n. Here we could see that one of the inputs is shifted in time by a value every
time it is multiplied with the other input signal. Linear Convolution is quite often used as a
method of implementing filters of various types.
MATLAB: - Program:
clc;
clear all;
close all;
disp('linear convolution program');
x=input('enter i/p x(n):');
m=length(x);
h=input('enter i/p h(n):');
n=length(h);
x=[x,zeros(1,n)];
subplot(2,2,1), stem(x);
title('i/p sequence x(n)is:');
xlabel('---->n');
ylabel('---->x(n)');grid;
h=[h,zeros(1,m)];
subplot(2,2,2), stem(h);
title('i/p sequence h(n)is:');
xlabel('---->n');
ylabel('---->h(n)');grid;
disp('convolution of x(n) & h(n) is y(n):');
y=zeros(1,m+n-1);
for i=1:m+n-1
y(i)=0;
for j=1:m+n-1
if(j<i+1)
y(i)=y(i)+x(j)*h(i-j+1);
end
end
end
y
subplot(2,2,[3,4]),stem(y);
title('convolution of x(n) & h(n) is :');
xlabel('---->n');
ylabel('---->y(n)');grid;
Output :
Mathematical Formula:
The linear convolution of two continuous time signals x(t) and h(t) is defined by
Where x(n) is the input signal and h(n) is the impulse response of the
Output:
1, 4, 10, 20, 25, 24, 16.
4.Enter the source code and save the file with “.C” extension.
5.Right click on source, Select add files to project and Choose “.C “ file Saved before.
8.Go to file and load program and load “.out” file into the board..
12. Green line is to choose the point, Value at the point can be seen
(Highlighted by circle at the left corner).
RESULT: Hence Linear Convolution is verified successfully using MATLAB and CC Studio.
VIVA QUESTIONS
1. Explain the significance of convolution.
2. Define linear convolution.
3. Why linear convolution is called as a periodic convolution?
4. Why zero padding is used in linear convolution?
5. What are the four steps to find linear convolution?
6. What is the length of the resultant sequence in linear convolution?
7. How linear convolution will be used in calculation of LTI system response?
8. List few applications of linear convolution in LTI system design.
9. Give the properties of linear convolution.
10. How the linear convolution will be used to calculate the DFT of a signal?
EXPERIMENT NO-3:
VERIFICATION OF CIRCULAR CONVOLUTION USING MATLAB AND CC STUDIO
EQUIPMENT REQUIRED:
THEORY
Circular convolution is another way of finding the convolution sum of two input signals. It
resembles the linear convolution, except that the sample values of one of the input
signals is folded and right shifted before the convolution sum is found. Also note that
circular convolution could also be found by taking the DFT of the two input signals and
finding the product of the two frequency domain signals. The Inverse DFT of the product
would give the output of the signal in the time domain which is the circular convolution
output. The two input signals could have been of varying sample lengths. But we take the
DFT of higher point, which ever signals levels to. For example, If one of the signal is of
length 256 and the other spans 51 samples, then we could only take 256 point DFT. So
the output of IDFT would be containing 256 samples instead of 306 samples, which
follows N1+N2 – 1 where N1 & N2 are the lengths 256 and 51 respectively of the two
inputs. Thus the output which should have been 306 samples long is fitted into 256
samples. The256 points end up being a distorted version of the correct signal. This
process is called circular convolution.
MATLAB:- Program:
clc;
clear all;
close all;
disp('circular convolution program');
x=input('enter i/p x(n):');
m=length(x);
h=input('enter i/p sequence h(n)');
n=length(h);
subplot(2,2,1),
stem(x);
title('i/p sequence x(n)is:');
xlabel('---->n');
ylabel('---->x(n)');
grid;
subplot(2,2,2),
stem(h);
title('i/p sequence h(n)is:');
xlabel('---->n');
ylabel('---->h(n)');
grid;
disp('circular convolution of x(n) & h(n) is y(n):');
if(m-n~=0)
if(m>n)
h=[h,zeros(1,m-n)];
n=m;
end
x=[x,zeros(1,n-m)];
m=n;
Department of Electronics & Communication 23
Engineering
UCE, AKNU DIGITAL SIGNAL PROCESSING LAB
end
y=zeros(1,n);
y(1)=0;
a(1)=h(1);
for j=2:n
a(j)=h(n-j+2);
end
%circular convolution
for i=1:n
y(1)=y(1)+x(i)*a(i);
end
for k=2:n
y(k)=0;
% circular shift
for j=2:n
x2(j)=a(j-1);
end
x2(1)=a(n);
for i=1:n
if(i<n+1)
a(i)=x2(i);
y(k)=y(k)+x(i)*a(i);
end
end
end
y
subplot(2,2,[3,4]),stem(y);
title('convolution of x(n) & h(n) is:');
xlabel('---->n');
ylabel('---->y(n)');
grid;
OUTPUT :
new Project:
1.To create project, go to Project and Select New.
Circular Convolution:
Let x1(n) and x2(n) are finite duration sequences both of length N with DFT’s
X1(k) and X2(k). Convolution of two given sequences x1(n) and x2(n) is given by
the equation,
x3(n) = IDFT[X3(k)]
N-1
x3(n) = ∑ x1(m) x2((n-
m))N m=0
Program:
#include<stdio.h>
int
m,n,x[30],h[30],y[30],i,j,temp[30],k,x2[30],
a[30]; void main()
{
int *y;
y=(int *)0x0000100;
printf(" enter the length of the first sequence\n");
Department of Electronics & Communication 26
Engineering
UCE, AKNU DIGITAL SIGNAL PROCESSING LAB
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 length of both sequences are not equal*/
{
if(m>n) /* Pad the smaller sequence with zero*/
{
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];
/*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];
}}
/*displaying the result*/
printf(" the circular convolution is\
n"); for(i=0;i<n;i++)
printf("%d ",y[i]);
}
Output:
the circular
convolution is 10 10 10
10
4.Enter the source code and save the file with “.C” extension.
5.Right click on source, Select add files to project .. and Choose “.C “ file Saved before.
8.Go to file and load program and load “.out” file into the board..
The corresponding output will be shown on the output window as shown below
11. To see the Graph go to View and select time/frequency in the Graph, and
give the correct Start address provided in the program, Display data can be taken as
per user.
12. Green line is to choose the point, Value at the point can be seen
(Highlighted by circle at the left corner).
RESULT: Hence Circular Convolution is verified successfully using MATLAB and CC Studio.
VIVA QUESTIONS
1. Give mathematical definition of circular convolution
2. Why circular convolution is called as periodic convolution?
3. Difference between linear convolution and circular convolution
4. Explain the circular shift
5. How circular convolution is used to calculate the Z-transform of a signal?
6. List few Applications of circular convolution
7. What are the different methods used to calculate circular convolution?
8. Explain properties of circular convolution?
9. Explain modulo N operation
10. What is the importance of circular convolution to realization of digital
systems or digital filters?
EXPERIMENT NO-4:
DESIGN OF FIR FILTER (LP/HP) USING WINDOWING TECHNIQUE
AIM: To design FIR filters (LP/HP) by using following windowing techniques on MATLAB
and DSK6713 KIT:
1)Rectangular 2) Triangular 3) Kaiser
EQUIPMENT REQUIRED:
THEORY:
A Finite Impulse Response (FIR) filter is a discrete linear time-invariant system whose
output is based on the weighted summation of a finite number of past inputs. An FIR
transversal filter structure can be obtained directly from the equation for discrete-
time convolution.
N 1
y(n) x(k)h(n 0 n N 1
k)
k 0
In this equation, x(k) and y(n) represent the input to and output from the filter at time
n. h(n-k) is the transversal filter coefficients at time n. These coefficients are
generated by using FDS (Filter Design Software or Digital filter design package).
FIR – filter is a finite impulse response filter. Order of the filter should be specified.
Infinite response is truncated to get finite impulse response. Placing a window of
finite length does this. Types of windows available are Rectangular, Bartlett,
Hamming, Hanning, Blackmann window etc., This FIR filter is an all zero filter.
OUTPUT:
// -0.003511, -0.003150,0.000000,0.007551,0.020655,
// 0.039383,0.062306,0.086494,0.108031,0.122944,
// 0.128279,0.122944,0.108031,0.086494,0.062306,
// 0.039383,0.020655,0.007551,0.000000, -0.003150,
// -0.003511, -0.002593, -0.001451, -0.000609, -0.000710,
// -0.000019};// kaiser low pass fir filter pass band range 0-500Hz
DSK6713_AIC23_Config
config={0x0017,0x0017,0x00d8,0x00d8,0x0011,0x0000,0x0000,0x0043,0x0081,0x0001};
//float filter_coeff[]={-0.000035,-0.000234,-0.000454,0.000000,0.001933,
// 0.004838,0.005671,-0.000000,-0.013596,-0.028462,
// -0.029370,0.000000,0.064504,0.148863,0.221349,
// 0.249983,0.221349,0.148863,0.064504,0.000000,
// -0.029370,-0.028462,-0.013596,-0.000000,0.005671,
// 0.004838,0.001933,0.000000,-0.000454,-0.000234,
// -0.000035};// kaiser low pass fir filter pass band range 0-1000Hz
float filter_coeff[]={-0.000046,-0.000166,0.000246,0.001414,0.001046,
-0.003421,-0.007410,0.000000,0.017764,0.020126,
-0.015895,-0.060710,-0.034909,0.105263,0.289209,
0.374978,0.289209,0.105263,-0.034909,-0.060710,
-0.015895,0.020126,0.017764,0.000000,-0.007410,
-0.003421,0.001046,0.001414,0.000246,-0.000166,
-0.000046};//Kaiser low pass fir filter pass band range 0-1500Hz
DSK6713_AIC23_Config
config={0x0017,0x0017,0x00d8,0x00d8,0x0011,0x0000,0x0000,0x0043,0x0081,0x0001};
void main()
{
DSK6713_AIC23_CodecHandle
hCodec; Uint32 l_input,
r_input,l_output, r_output;
DSK6713_init();
hCodec = DSK6713_AIC23_openCodec(0,
&config); DSK6713_AIC23_setFreq(hCodec,
1);
while(1)
{
while(!DSK6713_AIC23_read(hCodec, &l_input));
while(!DSK6713_AIC23_read(hCodec,
&r_input));
l_output=(Int16)FIR_FILTER(&filter_coeff ,l_input);
r_output=l_output;
while(!DSK6713_AIC23_write(hCodec, l_output));
while(!DSK6713_AIC23_write(hCodec, r_output));
}
DSK6713_AIC23_closeCodec(hCodec);
}
for(i=30;i>0;i--)
in_buffer[i] = in_buffer[i-1];
for(i=0;i<32;i++)
output = output + h[i] * in_buffer[i];
//output = x;
return(output);
}
#include
"dsk6713_aic23.h"
#include "stdio.h"
//float filter_coeff[]={0.000050,0.000223,0.000520,0.000831,0.000845,
// -0.000000,-0.002478,-0.007437,-0.015556,-0.027071,
// -0.041538,-0.057742,-0.073805,-0.087505,-0.096739,
// 0.899998,-0.096739,-0.087505,-0.073805,-0.057742,
// -0.041538,-0.027071,-0.015556,-0.007437,-0.002478,
// -
0.000000,0.000845,0.000831,0.000520,0.000223,
// 0.000050};//FIR High pass Kaiser filter pass band range 400Hz-
3.5KHz
float filter_coeff[]={0.000000,-0.000138,-0.000611,-0.001345,-0.001607,
-0.000000,0.004714,0.012033,0.018287,0.016731,
0.000000,-0.035687,-0.086763,-0.141588,-0.184011,
0.800005,-0.184011,-0.141588,-0.086763,-0.035687,
0.000000,0.016731,0.018287,0.012033,0.004714,
-0.000000,-0.001607,-0.001345,-0.000611,-0.000138,
0.000000};//FIR High pass Kaiser filter pass band range
800Hz-3.5KHz
//float filter_coeff[]={-0.000050,-0.000138,0.000198,0.001345,0.002212,-0.000000,
// -0.006489,-0.012033,-
0.005942,0.016731,0.041539,0.035687,
// -0.028191,-0.141589,-0.253270,0.700008,-0.253270,-
0.141589,
// -0.028191,0.035687,0.041539,0.016731,-0.005942,-
0.012033,
// -0.006489,-0.000000,0.002212,0.001345,0.000198,-0.000138,
// -0.000050};//FIR High pass Kaiser filter pass
band range 1200Hz-3.5KHz
DSK6713_AIC23_Config
config={0x0017,0x0017,0x00d8,0x00d8,0x0011,0x0000,0x0000,0x0043,0x0081,0x0001};
void main()
{
DSK6713_AIC23_CodecHandle hCodec;
Uint32 l_input, r_input,l_output,
r_output; DSK6713_init();
hCodec = DSK6713_AIC23_openCodec(0,
&config); DSK6713_AIC23_setFreq(hCodec,
1);
while(1)
{
while(!DSK6713_AIC23_read(hCodec, &l_input));
while(!DSK6713_AIC23_read(hCodec,
&r_input));
while(!DSK6713_AIC23_write(hCodec,
l_output)); while(!
DSK6713_AIC23_write(hCodec, r_output));
DSK6713_AIC23_closeCodec(hCodec);
}
for(i=30;i>0;i--)
in_buffer[i] = in_buffer[i-1];
for(i=0;i<32;i++)
output = output + h[i] * in_buffer[i];
//output = x;
return(output);
}
RECTANGULAR LPF:
#include "filtercfg.h"
#include "dsk6713.h"
#include
"dsk6713_aic23.h"
#include "stdio.h"
//float filter_coeff[]={-0.008982,-0.017782,-0.025020,-0.029339,-0.029569,
// -0.024895,-0.014970,0.000000,0.019247,0.041491,
// 0.065053,0.088016,0.108421,0.124473,0.134729,
// 0.138255,0.134729,0.124473,0.108421,0.088016,
// 0.065053,0.041491,0.019247,0.000000,-0.014970,
// -0.024895,-0.029569,-0.029339,-0.025020,-0.017782,
// -0.008982};//FIR Low pass Rectangular Filter
pass band range 0-500Hz
//float filter_coeff[]={-0.015752,-0.023869,-0.018176,0.000000,0.021481,
// 0.033416,0.026254,-0.000000,-0.033755,-0.055693,
// -0.047257,0.000000,0.078762,0.167080,0.236286,
// 0.262448,0.236286,0.167080,0.078762,0.000000,
// -0.047257,-0.055693,-0.033755,-0.000000,0.026254,
// 0.033416,0.021481,0.000000,-0.018176,-0.023869,
// -0.015752};//FIR Low pass Rectangular Filter
pass band range 0-1000Hz
float filter_coeff[]={-0.020203,-0.016567,0.009656,0.027335,0.011411,
-0.023194,-0.033672,0.000000,0.043293,0.038657,
-0.025105,-0.082004,-0.041842,0.115971,0.303048,
0.386435,0.303048,0.115971,-0.041842,-0.082004,
-0.025105,0.038657,0.043293,0.000000,-0.033672,
-0.023194,0.011411,0.027335,0.009656,-0.016567,
-0.020203};//FIR Low pass Rectangular Filter pass band range 0-1500Hz
DSK6713_AIC23_Config
config={0x0017,0x0017,0x00d8,0x00d8,0x0011,0x0000,0x0000,0x0043,0x0081,0x0001};
void main()
{
DSK6713_AIC23_CodecHandle hCodec;
Uint32 l_input, r_input,l_output,
r_output; DSK6713_init();
hCodec = DSK6713_AIC23_openCodec(0,
&config); DSK6713_AIC23_setFreq(hCodec,
1);
while(1)
{
while(!DSK6713_AIC23_read(hCodec, &l_input));
while(!DSK6713_AIC23_read(hCodec, &r_input));
l_output=(Int16)FIR_FILTER(&filter_coeff ,l_input);
r_output=l_output; while(!
DSK6713_AIC23_write(hCodec, l_output));
while(!DSK6713_AIC23_write(hCodec, r_output));
}
DSK6713_AIC23_closeCodec(hCodec);
}
for(i=30;i>0;i--)
in_buffer[i] = in_buffer[i-1];
for(i=0;i<32;i++)
output = output + h[i] * in_buffer[i];
//output = x;
return(output);
}
RECTANGULAR HPF:
#include "filtercfg.h"
#include "dsk6713.h"
#include
"dsk6713_aic23.h"
#include "stdio.h"
//float filter_coeff[]={0.021665,0.022076,0.020224,0.015918,0.009129,
// -0.000000,-0.011158,-0.023877,-0.037558,-0.051511,
// -0.064994,-0.077266,-0.087636,-0.095507,-0.100422,
// 0.918834,-0.100422,-0.095507,-0.087636,-0.077266,
// -0.064994,-0.051511,-0.037558,-0.023877,-0.011158,
// -
0.000000,0.009129,0.015918,0.020224,0.
022076,
// 0.021665};//FIR High pass Rectangular filter pass band range 400Hz-
3.5KHz
float filter_coeff[]={0.000000,-0.013457,-0.023448,-0.025402,-0.017127,
-0.000000,0.020933,0.038103,0.043547,0.031399,
0.000000,-0.047098,-0.101609,-0.152414,-0.188394,
0.805541,-0.188394,-0.152414,-0.101609,-0.047098,
0.000000,0.031399,0.043547,0.038103,0.020933,
-0.000000,-0.017127,-0.025402,-0.023448,-0.013457,
0.000000};//FIR High pass Rectangular filter pass band
range 800Hz-3.5KHz
//float filter_coeff[]={-0.020798,-0.013098,0.007416,0.024725,0.022944,
// -0.000000,-0.028043,-0.037087,-
0.013772,0.030562,
// 0.062393,0.045842,-0.032134,-0.148349,-
0.252386,
// 0.686050,-0.252386,-0.148349,-
0.032134,0.045842,
// 0.062393,0.030562,-0.013772,-0.037087,-
0.028043,
// -0.000000,0.022944,0.024725,0.007416,-0.013098,
// -0.020798};//FIR High pass Rectangular filter pass band range 1200Hz-3.5KHz
DSK6713_AIC23_Config
config={0x0017,0x0017,0x00d8,0x00d8,0x0011,0x0000,0x0000,0x0043,0x0081,0x0001};
void main()
{
DSK6713_AIC23_CodecHandle hCodec;
Uint32 l_input, r_input,l_output,
r_output; DSK6713_init();
hCodec = DSK6713_AIC23_openCodec(0,
&config); DSK6713_AIC23_setFreq(hCodec,
1);
while(1)
{
while(!DSK6713_AIC23_read(hCodec, &l_input));
while(!DSK6713_AIC23_read(hCodec,
&r_input));
l_output=(Int16)FIR_FILTER(&filter_coeff ,l_in
while(!DSK6713_AIC23_write(hCodec, l_output));
while(!DSK6713_AIC23_write(hCodec, r_output));
}
DSK6713_AIC23_closeCodec(hCodec);
for(i=30;i>0;i--)
in_buffer[i] = in_buffer[i-1];
for(i=0;i<32;i++)
output = output + h[i] * in_buffer[i];
//output = x;
return(output);
}
TRANGULAR LPF:
#include "filtercfg.h"
#include "dsk6713.h"
#include
"dsk6713_aic23.h"
#include "stdio.h"
//float filter_coeff[]={0.000000,-0.001185,-0.003336,-0.005868,-0.007885,
// -0.008298,-0.005988,0.000000,0.010265,0.024895,
// 0.043368,0.064545,0.086737,0.107877,0.125747,
// 0.138255,0.125747,0.107877,0.086737,0.064545,
// 0.043368,0.024895,0.010265,0.000000,-0.005988,
// -0.008298,-0.007885,-0.005868,-0.003336,-0.001185,
// 0.000000};//FIR Low pass Triangular Filter pass band range 0-500Hz
//float filter_coeff[]={0.000000,-0.001591,-0.002423,0.000000,0.005728,
// 0.011139,0.010502,-0.000000,-0.018003,-0.033416,
// -
0.031505,0.000000,0.063010,0.144802,0.
220534,
// 0.262448,0.220534,0.144802,0.063010,0.
000000,
// -0.031505,-0.033416,-0.018003,-0.000000,0.010502,
// 0.011139,0.005728,0.000000,-0.002423,-0.001591,
// 0.000000};//FIR Low pass Triangular Filter pass band range 0-
1000Hz
float filter_coeff[]={0.000000,-0.001104,0.001287,0.005467,0.003043,
-0.007731,-0.013469,0.000000,0.023089,0.023194,
-0.016737,-0.060136,-0.033474,0.100508,0.282844,
0.386435,0.282844,0.100508,-0.033474,-0.060136,
-0.016737,0.023194,0.023089,0.000000,-0.013469,
-0.007731,0.003043,0.005467,0.001287,-0.001104,
0.000000};//FIR Low pass Triangular Filter pass band range 0-1500Hz
void main()
{
DSK6713_AIC23_CodecHandle hCodec;
Uint32 l_input, r_input,l_output,
r_output; DSK6713_init();
hCodec = DSK6713_AIC23_openCodec(0,
&config); DSK6713_AIC23_setFreq(hCodec,
1);
while(1)
{
while(!DSK6713_AIC23_read(hCodec, &l_input));
while(!DSK6713_AIC23_read(hCodec, &r_input));
l_output=(Int16)FIR_FILTER(&filter_coeff ,l_input);
r_output=l_output; while(!
DSK6713_AIC23_write(hCodec, l_output));
while(!DSK6713_AIC23_write(hCodec, r_output));
}
DSK6713_AIC23_closeCodec(hCodec);
}
for(i=30;i>0;i--)
in_buffer[i] = in_buffer[i-1];
for(i=0;i<32;i++)
output = output + h[i] * in_buffer[i];
//output = x;
return(output);
}
TRANGULAR HPF
#include "filtercfg.h"
#include "dsk6713.h"
#include
"dsk6713_aic23.h"
#include "stdio.h"
//float filter_coeff[]={0.000000,0.001445,0.002648,0.003127,0.002391,
// -0.000000,-0.004383,-0.010943,-0.019672,-0.030353,
// -0.042554,-0.055647,-0.068853,-0.081290,-0.092048,
// 0.902380,-0.092048,-0.081290,-0.068853,-0.055647,
// -0.042554,-0.030353,-0.019672,-0.010943,-0.004383,
// -0.000000,0.002391,0.003127,0.002648,0.001445,
// 0.000000};//FIR High pass Triangular filter pass
band range 400Hz-3.5KHz
//float filter_coeff[]={0.000000,-0.000897,-0.003126,-0.005080,-0.004567,
// -0.000000,0.008373,0.017782,0.023225,0.018839,
// 0.000000,-0.034539,-0.081287,-0.132092,-
0.175834,
// 0.805541,-0.175834,-0.132092,-0.081287,-
0.034539,
// 0.000000,0.018839,0.023225,0.017782,0.0083
73,
// -0.000000,-0.004567,-0.005080,-0.003126,-
0.000897,
// 0.000000};//FIR High pass Triangular filter pass band
range
800Hz-3.5KHz
float filter_coeff[]={0.000000,-0.000901,0.001021,0.005105,0.006317,
-0.000000,-0.011581,-0.017868,-0.007583,0.018931,
0.042944,0.034707,-0.026541,-0.132736,-0.243196,
0.708287,-0.243196,-0.132736,-0.026541,0.034707,
0.042944,0.018931,-0.007583,-0.017868,-0.011581,
-0.000000,0.006317,0.005105,0.001021,-0.000901,
0.000000};//FIR High pass Triangular filter pass band
range
1200Hz-3.5KHz
DSK6713_AIC23_Config
config={0x0017,0x0017,0x00d8,0x00d8,0x0011,0x0000,0x0000,0x0043,0x0081,0x0001};
void main()
{
DSK6713_AIC23_CodecHandle hCodec;
Uint32 l_input, r_input,l_output,
r_output; DSK6713_init();
hCodec = DSK6713_AIC23_openCodec(0,
&config); DSK6713_AIC23_setFreq(hCodec,
1);
while(1)
{
while(!DSK6713_AIC23_read(hCodec, &l_input));
while(!DSK6713_AIC23_read(hCodec,
&r_input));
l_output=(Int16)FIR_FILTER(&filter_coeff ,l_input);
r_output=l_output;
while(!DSK6713_AIC23_write(hCodec, l_output));
DSK6713_AIC23_closeCodec(hCodec);
}
for(i=30;i>0;i--)
in_buffer[i] = in_buffer[i-1];
for(i=0;i<32;i++)
output = output + h[i] * in_buffer[i];
//output = x;
return(output);
}
SNAP SHOTS:
1. APPLIED INPUT TO FILTER
RESULT: The design of FIR filters (LP/HP) by using various windowing techniques is
done successfully using MATLAB and DSK6713 KIT.
VIVA QUESTIONS
1. What is a filter?
2. Differentiate analog filter and digital filter.
3. Define FIR filter.
4. What are the differences between recursive and non-recursive systems?
5. List a few Applications of FIR filters.
6. Explain advantages of FIR filters over IIR filters.
7. Explain limitations of FIR filters.
8. What is the different method to design FIR filters?
9. Explain different window functions.
10. Differentiate rectangular, triangular and Kaiser windows.
EXPERIMENT NO-5:
IIR FILTER (LP/HP) IMPLEMENTATION ON DSP PROCESSORS
AIM: To implement the IIR FILTERS (LPF/HPF) on DSK 6713 DSP starter kit
EQUIPMENT REQUIRED:
THEORY:
The IIR filter can realize both the poles and zeroes of a system because it has a rational
transfer function, described by polynomials in z in both the numerator and the
denominator
m and n are order of the two polynomials b (nb + 1) and a (na + 1) are the filter
coefficients. These filter coefficients are generated using FDS (Filter Design software
or Digital Filter design package. IIR filters can be expanded as infinite impulse response
filters. In designing IIR filters, cutoff frequencies of the filters should be mentioned. The
order of the filter can be estimated using Butterworth polynomial. That’s why the filters
are named as Butterworth filters. Filter coefficients can be found and the response can
be plotted.
#include "filtercfg.h"
#include "dsk6713.h"
#include
"dsk6713_aic23.h"
#include "stdio.h"
DSK6713_AIC23_Config
config={0x0017,0x0017,0x00d8,0x00d8,0x0011,0x0000,0x0000,0x0043,0x0081,0x0001};
void main()
{
DSK6713_AIC23_CodecHandle
hCodec; Uint32 l_input,
r_input,l_output, r_output;
DSK6713_init();
hCodec = DSK6713_AIC23_openCodec(0,
3);
while(1)
{
while(!DSK6713_AIC23_read(hCodec, &l_input));
while(!DSK6713_AIC23_read(hCodec,
&r_input));
l_output=IIR_FILTER(&filter_coeff ,l_input);
r_output=l_output; while(!
DSK6713_AIC23_write(hCodec, l_output));
while(!DSK6713_AIC23_write(hCodec, r_output));
}
DSK6713_AIC23_closeCodec(hCodec);
}
signed int IIR_FILTER(const signed int * h, signed int x1)
{
static signed int x[6] = {0,0,0,0,0,0};
temp; temp =
( (int)h[0] * x[0]);
temp >>=15;
y[2] = y[1];
y[1] = y[0];
x[2] = x[1];
return (temp<<2);
}
#include "filtercfg.h"
#include "dsk6713.h"
#include
"dsk6713_aic23.h"
#include "stdio.h"
DSK6713_AIC23_Config
config={0x0017,0x0017,0x00d8,0x00d8,0x0011,0x0000,0x0000,0x0043,0x0081,0x0001};
void main()
{
DSK6713_AIC23_CodecHandle hCodec;
Uint32 l_input, r_input,l_output,
r_output; DSK6713_init();
hCodec = DSK6713_AIC23_openCodec(0,
&config); DSK6713_AIC23_setFreq(hCodec,
3);
while(1)
{
while(!DSK6713_AIC23_read(hCodec, &l_input));
while(!DSK6713_AIC23_read(hCodec,
&r_input));
l_output=IIR_FILTER(&filter_coeff ,l_input);
r_output=l_output; while(!
DSK6713_AIC23_write(hCodec, l_output));
while(!DSK6713_AIC23_write(hCodec, r_output));
}
DSK6713_AIC23_closeCodec(hCodec);
}
int temp=0;
temp; temp =
( (int)h[0] * x[0]);
y[2] = y[1];
y[1] = y[0];
x[2] = x[1];
x[1] = x[0];
return (temp<<2);
}
#include "filtercfg.h"
#include "dsk6713.h"
#include
"dsk6713_aic23.h"
#include "stdio.h"
DSK6713_AIC23_Config
config={0x0017,0x0017,0x00d8,0x00d8,0x0011,0x0000,0x0000,0x0043,0x0081,0x0001};
void main()
{
DSK6713_AIC23_CodecHandle hCodec;
Uint32 l_input, r_input,l_output,
r_output; DSK6713_init();
hCodec = DSK6713_AIC23_openCodec(0,
&config); DSK6713_AIC23_setFreq(hCodec,
3);
while(1)
{
while(!DSK6713_AIC23_read(hCodec, &l_input));
while(!DSK6713_AIC23_read(hCodec,
&r_input));
l_output=IIR_FILTER(&filter_coeff ,l_input);
r_output=l_output; while(!
DSK6713_AIC23_write(hCodec, l_output));
while(!DSK6713_AIC23_write(hCodec, r_output));
}
DSK6713_AIC23_closeCodec(hCodec);
}
temp; temp =
( (int)h[0] * x[0]);
temp >>=15;
{
temp = -32767;
}
y[0] = temp;
y[2] = y[1];
y[1] = y[0];
x[2] = x[1];
x[1] = x[0];
return (temp<<2);
}
IIR CHEBYSHEV HP FILTER
#include "filtercfg.h"
#include "dsk6713.h"
#include
"dsk6713_aic23.h"
#include "stdio.h"
DSK6713_AIC23_Config
config={0x0017,0x0017,0x00d8,0x00d8,0x0011,0x0000,0x0000,0x0043,0x0081,0x0001};
void main()
{
DSK6713_AIC23_CodecHandle hCodec;
Uint32 l_input, r_input,l_output,
r_output; DSK6713_init();
hCodec = DSK6713_AIC23_openCodec(0,
&config); DSK6713_AIC23_setFreq(hCodec,
3);
while(1)
{
while(!DSK6713_AIC23_read(hCodec, &l_input));
while(!DSK6713_AIC23_read(hCodec,
&r_input));
l_output=IIR_FILTER(&filter_coeff ,l_inp
ut); r_output=l_output;
while(!DSK6713_AIC23_write(hCodec, l_output));
while(!DSK6713_AIC23_write(hCodec, r_output));
}
temp; temp =
( (int)h[0] * x[0]);
y[2] = y[1];
y[1] = y[0];
x[2] = x[1];
x[1] = x[0];
return (temp<<2);
}
RESULT: Hence implementation of IIR FILTERS (LPF/HPF) on DSK 6713 DSP starter
kit is done successfully.
VIVA QUESTIONS
1. List some advantages of digital filters over analog filters.
2. Write some differences between FIR and IIR filters.
3. What are the different methods to design IIR filters?
4. Why IIR filters are not reliable?
5. What are different applications of IIR filters?
6. What are advantages of IIR filters?
7. What are disadvantages of IIR filters?
8. Differentiate Butterworth and Chebyshev approximations.
9. What is meant by impulse response?
10. What is the importance of impulse response to calculate the o/p response of the filter?
EXPERIMENT NO-6:
VERIFICATION OF N-POINT FAST FOURIER TRANSFORM ALGORITHM
EQUIPMENT REQUIRED:
THEORY:
The Fast Fourier Transform is useful to map the time-domain sequence into a
continuous function of a frequency variable. The FFT of a sequence {x(n)} of length N is
given by a complex-valued sequence X(k).
The above equation is the mathematical representation of the DFT. As the number of
computations involved in transforming an N point time domain signal into its
corresponding frequency domain signal was found to be N 2 complex multiplications, an
alternative algorithm involving lesser number of computations is opted.
PROGRAM:
clc;
clear all;
close all;
tic;
x=input('enter the sequence');
n=input('enter the length of fft');
%compute fft
disp('fourier transformed signal');
X=fft(x,n)
subplot(1,2,1);stem(x);
title('i/p signal');
xlabel('n --->');
ylabel('x(n) -->');grid;
subplot(1,2,2);stem(X);
title('fft of i/p x(n) is:');
xlabel('Real axis --->');
ylabel('Imaginary axis -->');grid;
OUTPUT:
VIVA QUESTIONS
1. Define transform. What is the need for transform?
2. Differentiate Fourier transform and discrete Fourier transform.
3. Differentiate DFT and DTFT.
4. What are the advantages of FFT over DFT?
5. Differentiate DITFFT and DIFFFT algorithms.
6. What is meant by radix?
7. What is meant by twiddle factor and give its properties?
8. How FFT is useful to represent a signal?
9. Compare FFT and DFT with respect to number of calculation required?
10. How the original signal is reconstructed from the FFT of a signal?
EXPERIMENT NO-7:
GENERATION OF SUM OF SINUSOIDAL SIGNALS USING MATLAB
EQUIPMENT REQUIRED:
THEORY:
When two sinusoids are added together the result depends upon their amplitude, frequency and phase. The
effects are easiest to observe when only one of these is varied between the two sinusoids being added.
In the simplest case, when two sinusoids with the same frequency and phase but with different amplitudes are
added together the result is a sinusoid who's amplitude is the sum of the originals and who's frequency and
phase remain unchanged.
When the two sinusoids have different frequencies the result is more complicated. The new signal is no longer a
sinusoid since it doesn't follow the simple up and down pattern. Instead we see the higher frequency sinusoid as
a `ripple' superimposed on the lower frequency sinusoid (see figure). The frequency of the resulting signal will
be the lower of the two original frequencies. In the figure we can see that the resulting signal goes through two
and a half cycles (that is it repeats itself this many times) just like the second sinusoid. The amplitude of the
resulting signal is the sum of the originals and the phase is unchanged.
Adding together sinusoids with different phases can have surprising results. If two sinusoids are `in phase' then
their peaks and troughs coincide and the result is as observed earlier. If the sinusoids are `out of phase' or in
other words if they differ in phase by π radians then their peaks and troughs oppose each other and they will
cancel each other out. The phase of the resulting sinusoid is the sum of the phases of the constituents.
Adding up more than two sinusoids can produce complex looking waveforms. When a number of different
frequencies are combined the frequency of the result will in general be that of the lowest frequency component.
This is often called the fundamental frequency of the signal.
PROGRAM:
clc;
clear all;
close all;
tic;
%giving linear spaces
t=0:.01:pi;
% t=linspace(0,pi,20);
%generation of sine signals
y1=sin(t);
y2=sin(3*t)/3;
y3=sin(5*t)/5;
y4=sin(7*t)/7;
y5=sin(9*t)/9;
y = sin(t) + sin(3*t)/3 + sin(5*t)/5 + sin(7*t)/7 + sin(9*t)/9;
plot(t,y,t,y1,t,y2,t,y3,t,y4,t,y5);
legend('y','y1','y2','y3','y4','y5');
title('generation of sum of sinusoidal signals');grid;
ylabel('---> Amplitude');
xlabel('---> t');
toc;
OUTPUT:
EXPERIMENT NO-8:
VERIFICATION THE FREQUENCY RESPONSE OF ANALOG LP/HP FILTERS USING
MATLAB
AIM: To verify the frequency response of analog LP/HP filters using MATLAB.
EQUIPMENT REQUIRED:
THEORY:
Analog Low pass filter & High pass filter are obtained by using Butterworth or Chebyshev
filter with coefficients are given. The frequency – magnitude plot gives the frequency
response of the filter.
PROGRAM:
clc;
clear all;
close all;
warning off;
disp('enter the IIR filter design specifications');
rp=input('enter the passband ripple');
rs=input('enter the stopband ripple');
wp=input('enter the passband freq');
ws=input('enter the stopband freq');
fs=input('enter the sampling freq');
w1=2*wp/fs;w2=2*ws/fs;
[n,wn]=buttord(w1,w2,rp,rs,'s');
c=input('enter choice of filter 1. LPF 2. HPF \n ');
if(c==1)
disp('Frequency response of IIR LPF is:');
[b,a]=butter(n,wn,'low','s');
end
if(c==2)
disp('Frequency response of IIR HPF is:');
[b,a]=butter(n,wn,'high','s');
end
w=0:.01:pi;
[h,om]=freqs(b,a,w);
m=20*log10(abs(h));
an=angle(h);
figure,subplot(2,1,1);plot(om/pi,m);
title('magnitude response of IIR filter is:');
xlabel('(a) Normalized freq. -->');
ylabel('Gain in dB-->');
subplot(2,1,2);plot(om/pi,an);
title('phase response of IIR filter is:');
xlabel('(b) Normalized freq. -->');
ylabel('Phase in radians-->');
OUTPUT:
RESULT: Hence the frequency response of analog LP/HP filters using MATLAB is
verified successfully.
VIVA QUESTIONS
1. What are the filter specifications required to design the analog filters?
2. What is meant by frequency response of filter?
3. What is meant by magnitude response?
4. What is meant by phase response?
5. Differentiate ideal filter and practical filter responses.
6. What are the different types of analog filter approximations?
7. Define order of the filter and explain important role it plays in designing of a filter.
8. Explain advantages and disadvantages of Butterworth filter
9. Explain advantages and disadvantages of Chebyshev filter
10. Why Chebyshev is better than Butterworth filter?
EXPERIMENT NO-9:
COMPUTATION OF POWER DENSITY SPECTRUM OF A SEQUENCE USING MATLAB
EQUIPMENT REQUIRED:
PROGRAM:
t = 0:0.001:0.6;
x = sin(2*pi*50*t)+sin(2*pi*120*t);
y = x + 2*randn(size(t));
figure, plot(1000*t(1:50),y(1:50)) ;
title('Signal Corrupted with Zero-Mean Random Noise');
xlabel('time (milliseconds)');
Y = fft(y,512);
%The power spectral density, a measurement of the energy at various
frequencies, is:
Pyy = Y.* conj(Y) / 512;
f = 1000*(0:256)/512;
figure, plot(f,Pyy(1:257));
title('Frequency content of y');
xlabel('frequency (Hz)');
OUTPUT:
RESULT: Hence the Power Density Spectrum of a given sequence using MATLAB is
computed successfully.
VIVA QUESTIONS
1. Define power signal.
2. Define energy signal.
3. Define power spectral density of a signal.
4. How the energy of a signal can be calculated?
5. Explain difference between energy spectral density and power spectral density.
6. Explain the PSD plot.
7. What is the importance of PSD?
8. What are the applications of PSD?
9. Explain MATLAB function randn(size(n)).
10. What is the need to represent the signal in frequency domain?
EXPERIMENT NO-10:
COMUTATION OF FFT OF 1-D SIGNAL USING MATLAB
EQUIPMENT REQUIRED:
THEORY:
A fast Fourier transform (FFT) is an efficient algorithm to compute the discrete
Fourier transform (DFT) and it’s inverse. There are many distinct FFT algorithms involving
a wide range of mathematics, from simple complex-number arithmetic to group theory
and number theory; this article gives an overview of the available techniques and some
of their general properties, while the specific algorithms are described in subsidiary
articles linked below.
A DFT decomposes a sequence of values into components of different
frequencies. This operation is useful in many fields (see discrete Fourier transform for
properties and applications of the transform) but computing it directly from the definition
is often too slow to be practical. An FFT is a way to compute the same result more
quickly: computing a DFT of N points in the naive way, using the definition, takes (N2)
arithmetical operations, while an FFT can compute the same result in only
(N log N) operations. The difference in speed can be substantial, especially for long data
sets where N may be in the thousands or million in practice, the computation time can be
reduced by several orders of magnitude in such cases, and the improvement is roughly
proportional to N / log(N).
C Program:
#include<stdio.h>
#include<math.h>
#define N 32
#define pI
3.14159
typedef struct
{
float real,imag;
}
complex;
float
iobuffer[N];
float y[N];
main()
{
int i;
complex w[N];
complex x[N];
complex
temp1,temp2;
int
j,k,upper_leg,lower_leg,leg_diff,index,ste
p; for(i=0;i<N;i++)
{
iobuffer[i]=sin((2*pI*2*i)/32.0);
}
for(i=0;i<N;i++)
{
x[i].real=iobuffer[i];
Department of Electronics & Communication 78
Engineering
UCE, AKNU DIGITAL SIGNAL PROCESSING LAB
x[i].imag=0.0;
}
for(i=0;i<N;i++)
{
w[i].real=cos((2*pI*i)/(N*2.0));
w[i].imag=sin((2*pI*i)/(N*2.0));
}
leg_diff=N/2;
step=2;
for(i=0;i<5;i
++)
{
index=0;
for(j=0;j<leg_diff;j
++)
{
for(upper_leg=j;upper_leg<N;upper_leg+=(2*leg_diff))
{
lower_leg=upper_leg+leg_diff; temp1.real=(x[upper_leg]).real+
(x[lower_leg]).real; temp1.imag=(x[upper_leg]).imag+
(x[lower_leg]).imag; temp2.real=(x[upper_leg]).real-
(x[lower_leg]).real; temp2.imag=(x[upper_leg]).imag-
(x[lower_leg]).imag; (x[lower_leg]).real=temp2.real*(w[index]).real-
temp2.imag*(w[index]).imag;
(x[lower_leg]).imag=temp2.real*(w[index]).imag+temp2.imag*(w[index
]).real; (x[upper_leg]).real=temp1.real;
(x[upper_leg]).imag=temp1.imag;
}
index+=step;
}
leg_diff=(leg_diff)/
2; step=step*2;
}
j=
0;
for(i=1;i<(N-1);i++)
{
k=N/2;
while(k<=
j)
{
j=j-k;
k=k/2
;
}
j=j+
k;
if(i<j
)
{
temp1.real=(x[j]).real;
temp1.imag=(x[j]).imag;
(x[j]).real=(x[i]).real;
(x[j]).imag=(x[i]).imag;
(x[i]).real=temp1.real;
(x[i]).imag=temp1.imag;
}
}
for(i=0;i<N;i++)
{
y[i]=sqrt((x[i].real*x[i].real)+(x[i].imag*x[i].imag));
}
Department of Electronics & Communication 80
Engineering
UCE, AKNU DIGITAL SIGNAL PROCESSING LAB
for(i=0;i<N;i++)
{
printf("%f\t",y[i]);
}
return(0);
}
OUTPUT:
Graph Of Input Signal: sinusoidal Signal
RESULT: Hence the FFT of given 1-D signal is computed and plotted successfully.
VIVA QUESTIONS
1. Define signal, Give Examples for 1-D, 2-D, 3-D signals.
2. Explain mathematical formula for calculation of FFT.
3. Explain mathematical formula for calculation of IFFT.
4. How to calculate FT for 1-D signal?
5. Define DFT for 1-D signal.
6. What is meant by magnitude plot, phase plot, power spectrum?
7. Explain the importance of FFT.
8. Explain the applications of FFT.
9. What are separable transforms?
10. Explain Modulation property of Fourier Transform.
EXPERIMENT-11:
FREQUENCY RESPONSE OF ANTI IMAGING AND ANTI ALIASING FILTERS
AIM: To observe the frequency responses of anti imaging and anti aliasing filters.
EQUIPMENT REQUIRED:
THEORY:
The FIR Interpolator object up samples an input by the integer up sampling factor,
L, followed by an FIR anti-imaging filter. The filter coefficients are scaled by the
interpolation factor. A poly phase interpolation structure implements the filter. The
resulting discrete-time signal has a sampling rate L times the original sampling rate. The
demo versions illustrate two possible decimator design solutions. The floating-point
version model uses a cascade of three poly phase FIR decimators. This approach reduces
computation and memory requirements as compared to a single decimator by using
lower-order filters. Each decimator stage reduces the sampling rate by a factor of four.
The fixed-point version uses a five-section CIC decimator to reduce the sampling rate by
the same factor of 64. While not as flexible as a FIR decimator, the CIC decimator has the
advantage of not requiring any multiply operations. It is implemented using only
additions, subtractions, and delays. Therefore, it is a good choice for a hardware
implementation where computational resources are limited.
OUTPUT:
OUTPUT:
VIVA QUESTIONS
1. Explain about multi rate digital signal processing.
2. List the Applications of multi rate digital signal processing.
3. Define interpolation.
4. Define decimation.
5. Define aliasing.
6. What is meant anti-aliasing?
7. What is the effect of anti-imaging filter?
8. Define sampling rate.
9. What is the use of sampling rate convertors?
10. Explain advantages of anti-aliasing filters.
I. Consignment list
1.A main board of DSP6713 -1No
2.Power Supply 5V, 3A. - 1No
3.USB Programmer-1No
4.USB Cable -1No
4.Head Phone with MIC -1No
5.Audio Jack -3No [1+2]
6.Sample and Syllabus Programs CD -1No
7.DSP Lab Manual -1No
1.Install CCS V3.1 software according to the Custom Install default Custom Install_could
changes the installation directory. Following is an example of install the software under C
disk root directory.
2.Install USB Emulator choose to install directory from CCS v3.1 that is if CCSv3.1 is
installed in C: / CCStudio_v3.1 directory, then install the USB emulator driver in this
directory.
2.Select Create Board (Marked in Circle, can witness in the below Figure)
3.Right Click on the TI XDS510 emulator and select add to system. Enter,
(After selecting that options a Connection Properties window will be opened as
shown in step 4).
5.Choose the option falling edge is JTAG Standard in TMS/TDO Output Timing.
d) Click on Ok.
10. Go to Debug and select the option connect by holding Reset button on the Board.
FFT
clc;
clear all;
close all;
x=input('Enter the sequence : ')
N=length(x)
xK=fft(x,N)
xn=ifft(xK)
n=0:N-1;
subplot (2,2,1);
stem(n,x);
xlabel('n---->');
ylabel('amplitude');
title('input sequence');
subplot (2,2,2);
stem(n,abs(xK));
xlabel('n---->');
ylabel('magnitude');
title('magnitude response');
subplot (2,2,3);
stem(n,angle(xK));
xlabel('n---->');
ylabel('phase');
title('Phase responce');
subplot (2,2,4);
stem(n,xn);
xlabel('n---->');
ylabel('amplitude');
VIVA QUESTIONS:
1. Define sequence and signal?
2. Differentiate periodic and non-periodic signals?
3. Define period of the signal?
4. Define LTI system. 5. What is filtering?