Professional Documents
Culture Documents
B. Tech.
SEM. VI (EC)
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 15
PART I
LAB MANUAL
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 16
TABLE OF CONTENTS
4 Application Of Correlation 16
7 Applications Of Dsp 42
8 Introduction To Ccstudio 57
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 17
LAB 1
Discrete Signal Generation
Introduction:
Signals are broadly classified into analog & discrete signals. An analog signal will be denoted by x(t), in
which the variable t can represent any physical quantity. A discrete signal will be denoted by x(n), in
which the variable n is integer valued and represents discrete instances in time. Therefore it is called a
discrete time signal, which is a number sequence and will be denoted by one of the following
notations:
x(n)=,…,x(-1),x(0),x(1),….-
clc;
clear;
xdel(winsid());
t=0:0.1:20;
f=0.2;
pi=3.14;
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 18
title('Impulse','color','red','fontsize', 4);
xlabel("Index", "fontsize", 2,"color", "blue");
ylabel("Amplitude", "fontsize", 2, "color", "blue");
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 19
error('arugument incorrect');
end
n=[n1:n2];
x8=[(n-n0)>=0,1];
subplot(122);
plot(n,x8(n1:n2),'cya+','marker','d','markerfac','green','markeredg','red');
title('Step Sequence','color','red','fontsize', 4);
xlabel("Index", "fontsize", 2,"color", "blue");
ylabel("Amplitude", "fontsize", 2, "color", "blue");
CONCLUSION:
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 20
LAB 2
DISCRETE SIGNAL OPERATIONS
THEORY:
Various signal operations are used in achieving more complex signal operations. The signal operation
like flipping, shifting, addition, multiplication is used in implementation of convolution, correlation
like operations.
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 21
// Multiplication of Two Sequences //
scf();
subplot(311);
bar(n,y1,0.1,'red');
title('Sequence_1','color','red','fontsize', 4);
xlabel("Index", "fontsize", 2,"color", "blue",'position',[0.3 0.3]);
ylabel("Amplitude", "fontsize", 2, "color", "blue");
subplot(312);
bar(n,y2,0.1,'yellow');
title('Sequence_2','color','red','fontsize', 4);
xlabel("Index", "fontsize", 2,"color", "blue",'position',[0.3 0.3]);
ylabel("Amplitude", "fontsize", 2, "color", "blue");
subplot(313)
bar(n,x,0.1,'Green');
//plot(n,y,'cya+','marker','d','markerfac','red','markeredg','yel');
title('Multiplication of Sequences','color','red','fontsize', 4);
xlabel("Index", "fontsize", 2,"color", "blue",'position',[0.3 0.3]);
ylabel("Amplitude", "fontsize", 2, "color", "blue");
Signal Flipping:
clc;
clear;
xdel(winsid());
x2=input("Enter the Sequence :"); // [2 3 5 6 4 8 6];
x3=mtlb_fliplr(x2);
n3=1:length(x2);
n3=-mtlb_fliplr(n3);
scf();
subplot(2,1,1);
bar(x2,0.1,'red');
title('Original Sequence','color','red','fontsize', 4);
xlabel("Index", "fontsize", 2,"color", "blue",'position',[0.3 0.3]);
ylabel("Amplitude", "fontsize", 2, "color", "blue");
subplot(2,1,2);
bar(n3,x3,0.1,'green');
title('Folded Sequence','color','green','fontsize', 4);
xlabel("Index", "fontsize", 2,"color", "blue",'position',[0.3 0.3]);
ylabel("Amplitude", "fontsize", 2, "color", "blue");
Signal Shifting:
clc;
clear;
xdel(winsid());
x2=input("Enter the Sequence :"); // [2 3 5 6 4 8 6];
factor=input("Enter the Shifting Factor :"); // Example : -2 or 2
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 22
a=[];
t=[];
for i=1:length(x2)
t=[t (i-factor)];
a=[a x2(i)];
end
temp=[];
if(factor>0)
a=[a zeros(1,factor)];
for j=1:factor
temp=[temp t(length(t))+j];
end
t=[t temp];
end
if(factor<0)
a=[zeros(1,-factor) a];
for j=1:-factor
temp=[temp j];
end
t=[temp t];
end
scf();
subplot(2,1,1);
bar(x2,0.1,'red');
title('Original Sequence','color','red','fontsize', 4);
xlabel("Index", "fontsize", 2,"color", "blue",'position',[0.3 0.3]);
ylabel("Amplitude", "fontsize", 2, "color", "blue");
title('Original Sequence');
subplot(2,1,2);
bar(t,a,0.1,'green');
title('Shfted Sequence','color','red','fontsize', 4);
xlabel("Index", "fontsize", 2,"color", "blue",'position',[0.3 0.3]);
ylabel("Amplitude", "fontsize", 2, "color", "blue");
CONCLUSION:
ASSIGNMENT
1. x(n)=2delta(n+2)-delta(n-4), -5<=n<=5;
2. x(n)=n[u(n)-u(n-10)+exp(-0.3(n-10))[u(n-10)-u(n-20)], 0<=n<=20;
3. x(n)=n[u(n)-u(n-10)+exp(-0.3(n-10))[u(n-10)-u(n-20)], 0<=n<=20;
4. 2*x(n-5)-3*x(n+4);
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 23
LAB 3
CONVOLUTION AND CORRELATION
THEORY : Convolution and polynomial multiplication syntax w=conv(u,v) convolves vectors u and v.
Algebraically, convolution is the same as operation as multiplying the polynomials whose coefficients
are the elements of u and v. Definition: Let m=length (u) and n=length (v). Then w is the vector of
length (m+n-1) whose kth element is the sum over all the values of j which lead to legal subscripts for
u(j) and v(k+1-j), specifically j= max(1,k+1-n): min(k,m). When m=n, this gives
w(3)= u(1)*v(3)+u(2)*v(2)+u(3)*v(1)
...
w(n)= u(1)*v(n)+u(2)*v(n-1)+...+u(n)*v(1)
...
w(2*n-1)= u(n)*v(n)
The convolution theorem says, roughly, the convolving two sequences is the same as multiplying their
Fourier transforms. In order to make this precise, it is necessary to pad the two vectors with zeros
and ignore round off error. Thus, if X=fft([x,zeros(1,length(y)-1)]) and Y=fft([y,zeros(1,length(y)-1)])
then conv(x,y)=ifft(X.*Y).
If x[n] is input and h[n] is the system impulse response then system response
Y[n] = =
clc;
clear;
xdel(winsid());
x1=input("Enter the Sequence_1 :"); // [1 2 3 4 5];
x2=input("Enter the Sequence_2 :"); // [5 4 8];
n = length(x1);
m = length(x2);
for k = 1:(m+n-1)
w(k) = 0;
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 24
for j =max(1,k+1-m) : min(k,n)
w(k)= w(k)+(x1(j)*x2(k+1-j));
end
end
scf();
subplot(3,1,1);
bar(x1,0.1,'red');
title('Sequence_1','color','red','fontsize', 4);
xlabel("Index", "fontsize", 2,"color", "blue",'position',[0.6 0.3]);
ylabel("Amplitude", "fontsize", 2, "color", "blue");
subplot(3,1,2);
bar(x2,0.1,'yellow');
title('Sequence_2','color','red','fontsize', 4);
xlabel("Index", "fontsize", 2,"color", "blue",'position',[0.6 0.3]);
ylabel("Amplitude", "fontsize", 2, "color", "blue");
subplot(3,1,3);
bar(w,0.1,'green');
title('Convoled Sequence','color','green','fontsize', 4);
xlabel("Index", "fontsize", 2,"color", "blue",'position',[0.3 0.3]);
ylabel("Amplitude", "fontsize", 2, "color", "blue");
OUTPUT:
z=
5 16 34 52 45 28
y=
w=
2 7 16 30 34 31 20
THEORY :Correlation is a measure of similarity between two signals and is found using a process
similar to convolution. The discrete correlation (denoted **) of x[n] and h[n] is defined by
Correlation is equivalent to performing the convolution of x[n] with flipped signal h[-n].
clc;
clear;
xdel(winsid());
x=[2 4 5 6];
y=[2 4 5];
m=length(x);
n=length(y);
for k=1:m+n-1
w(k)=0;
for j=max(1,k+1-n):min(k,m)
w(k)=w(k)+(x(j)*y(n-k+j));
end
end
scf();
subplot(3,1,1);
bar(x,0.1,'red');
title('Sequence_1','color','red','fontsize', 4);
xlabel("Index", "fontsize", 2,"color", "blue",'position',[0.6 0.3]);
ylabel("Amplitude", "fontsize", 2, "color", "blue");
subplot(3,1,2);
bar(y,0.1,'yellow');
title('Sequence_2','color','red','fontsize', 4);
xlabel("Index", "fontsize", 2,"color", "blue",'position',[0.6 0.3]);
ylabel("Amplitude", "fontsize", 2, "color", "blue");
subplot(3,1,3);
bar(w,0.1,'green');
title('Correlation of Sequences','color','green','fontsize', 4);
xlabel("Index", "fontsize", 2,"color", "blue",'position',[0.3 0.3]);
ylabel("Amplitude", "fontsize", 2, "color", "blue");
CONCLUSION:
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 26
LAB 4
CORRELATION APPLICATION
AIM :
(I) To detect the object’s presence in RADAR using correlation.
(II) To detect transmitted binary sequence at receiver side
clc;
clear;
xdel(winsid());
x=[0 1 2 3 2 1 0]; //Triangle pulse transmitted by radar
n=[-3 -2 -1 0 1 2 3]; // Index of Triangular Pulse
D=10; // Delay amount
nd=n+D; // Index of Delayed Signal
y=x; // Delayed Signal
scf();
subplot(2,1,1);
bar(n,x,0.1,'red');
title('Original Transmitted Signal','color','red','fontsize', 4);
xlabel("Index", "fontsize", 2,"color", "blue");
ylabel("Amplitude", "fontsize", 2, "color", "blue");
subplot(2,1,2);
bar(nd,y,0.1,'yellow');
title('Delayed Signal','color','red','fontsize', 4);
xlabel("Index", "fontsize", 2,"color", "blue");
ylabel("Amplitude", "fontsize", 2, "color", "blue");
w=rand(1,length(x)); // Noise Generation
nw=nd;
scf();
bar(nw,w,0.1,'red');
title('Noisy Signal','color','red','fontsize', 4);
xlabel("Index", "fontsize", 2,"color", "blue");
ylabel("Amplitude", "fontsize", 2, "color", "blue");
// If object is present we receive the signal R(n) = x(n-D) + Noise
R=y+w; // Original Signal+Noise
nr=nw; // Index of received signal at RADAR
nr_fold=mtlb_fliplr(nr);
R_fold=mtlb_fliplr(R);
nmin=min(n)+min(nr_fold); // Lowest index of y(n)
nmax=max(n)+max(nr_fold); // Highest index of y(n)
n_received=nmin:nmax;
Received_Presence=conv(x,R_fold); // Convolution of Original signal and Received Signal in the
Presence of Object (Equvalent to Correlation)//
scf();
subplot(2,1,1);
bar(n_received,Received_Presence,0.1,'red');
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 27
title('Correlation in the Presence of Object','color','red','fontsize', 4);
xlabel("Index", "fontsize", 2,"color", "blue");
ylabel("Correlation Value", "fontsize", 2, "color", "blue");
// If object is not present we receive the signal R(n) = Noise
R=w; // only Noise Signal
nr=nw;
nr_fold=mtlb_fliplr(nr);
R_fold=mtlb_fliplr(R);
nmin=min(n)+min(nr_fold); // Lowest index of y(n)
nmax=max(n)+max(nr_fold); // Highest index of y(n)
n_received=nmin:nmax;
Received_Absence=conv(x,R_fold); // Convolution of Original transmitted signal and Received Signal in
the Absence of Object (Equvalent to Correlation)//
subplot(2,1,2);
bar(n_received,Received_Absence,0.1,'Green');
title('Correlation in the Absence of Object','color','red','fontsize', 4);
xlabel("Index", "fontsize", 2,"color", "blue");
ylabel("Correlation Value", "fontsize", 2, "color", "blue");
clc;
clear;
xdel(winsid());
N=30; // Length of the signal
n=0:N-1;
pi=3.14;
x0=sin(n*pi/8); // For '0' transmission
x1=sin(n*pi/4); // For '1' transmission
scf();
subplot(2,1,1);
bar(n,x0,0.1,'red');
title('Sin(n*pi/8) to Represent Binary 0','color','red','fontsize', 4);
xlabel("Index", "fontsize", 2,"color", "blue");
ylabel("Amplitude", "fontsize", 2, "color", "blue");
subplot(2,1,2);
bar(n,x1,0.1,'yellow');
title('Sin(n*pi/4) to Represent Binary 1','color','red','fontsize', 4);
xlabel("Index", "fontsize", 2,"color", "blue");
ylabel("Amplitude", "fontsize", 2, "color", "blue");
w=rand(1,N); // Noise Signal
y0=x0+w; // Original Signal + Noise Signal
y1=x1+w; // Original Signal + Noise Signal
// If received signal is y0(n)
rx0y0=xcorr(x0,y0); // crosscorrelation between x0(n) and y0(n)
rx1y0=xcorr(x1,y0); // crosscorrelation between x1(n) and y0(n)
scf();
subplot(2,1,1);
bar(rx0y0,0.1,'red');
title('Correlation between x0 and y0','color','red','fontsize', 4);
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 28
xlabel("Index", "fontsize", 2,"color", "blue");
ylabel("Amplitude", "fontsize", 2, "color", "blue");
subplot(2,1,2);
bar(rx1y0,0.1,'green');
title('Correlation between x1 and y0','color','red','fontsize', 4);
xlabel("Index", "fontsize", 2,"color", "blue");
ylabel("Amplitude", "fontsize", 2, "color", "blue");
// If received signal is y1(n)
rx0y1=xcorr(x0,y1); // crosscorrelation between x0(n) and y1(n)
rx1y1=xcorr(x1,y1); // crosscorrelation between x1(n) and y1(n)
scf();
subplot(2,1,1);
bar(rx0y1,0.1,'red');
title('Correlation between x0 and y1','color','red','fontsize', 4);
xlabel("Index", "fontsize", 2,"color", "blue");
ylabel("Amplitude", "fontsize", 2, "color", "blue");
subplot(2,1,2);
bar(rx1y1,0.1,'green');
title('Correlation between x1 and y1','color','red','fontsize', 4);
xlabel("Index", "fontsize", 2,"color", "blue");
ylabel("Amplitude", "fontsize", 2, "color", "blue");
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 29
CONCLUSION:
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 30
LAB 5
DFT & IDFT
AIM: To Perform operation of DFT & IDFT with and without MATLAB inbuilt function.
THEORY:
The DSP processors are used to perform frequency analysis of signals. To do the frequency analysis
we should convert the time domain signal into the frequency domain.
For this , the different frequency transformation techniques are used. Using DTFT (discreteTime
Fourier transform) we can convert the discrete time domain sequence into frequencyDomain. But
X(w) is a continuous function of frequency and therefore it is not a convenientRepresentation of x(n).
So, we represent sequence x(n) by samples of its spectrum X(w). Such a frequency domain
Representation leads to DFT.(Discrete Fourier transform).
N-1
n=0
N-1
K=0
DFT computes N equally spaced frequency samples of the DTFT. Both the indices n and K are ranging
from 0 to N-1.The integer n is known as time index since it denotes the time instant. The integer K
denotes discrete frequency and is called frequency index.
FFT(X) : is the discrete Fourier transform (DFT) of vector X. For matrices, the FFT operation is applied
to each column.
FFT(X,N): is the N-point FFT, padded with zeros if X has less than N points and truncated if it has more.
FFT(X,[ ],DIM) or FFT(X,N,DIM) applies the FFT operation across the dimension DIM.
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 31
Y = fftn(X) returns the discrete Fourier transform (DFT) of X, computed with a multidimensional fast
Fourier transform (FFT) algorithm. The result Y is the same size as X.
Y = fftn (X,size) pads X with zeros, or truncates X, to create a multidimensional array of size siz before
performing the transform. The size of the result Y is siz.
Y = fftshift(X) rearranges the outputs of fft, fft2, and fftn by moving the zero-frequency component to
the center of the array. It is useful for visualizing a Fourier transform with the zero-frequency
component in the middle of the spectrum.
Y = ifft(X) returns the inverse discrete Fourier transform (DFT) of vector X, computed with a fast
Fourier transform (FFT) algorithm. If X is a matrix, ifft returns the inverse DFT of each column of the
matrix.
stem(abs(y)); 8
title('dft'); 7
xlabel('time');
6
ylabel('amplitude');
amplitude
0
1 1.5 2 2.5 3 3.5 4
time
clc;
close all;
clear all;
x=[1 2 3 4];
N=length(x);
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 32
for k=1:N
y(k)=0;
for n=1:N
y(k)=y(k)+(x(n)*exp((-2*pi*(k-1)*(n-1)*j)/N));
end
end
stem(abs(y));
title('u-d fft');
xlabel('time');
ylabel('amplitude');
u-d fft
10
6
amplitude
0
1 1.5 2 2.5 3 3.5 4
time
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 33
3. IDFT using inbuilt function:
inbuilt fft
6
clc;
close all; 5
clear all;
x=[1 2 3]; 4
y=fft(x);
amplitude
3
stem(abs(y));
title('inbuilt fft'); 2
xlabel('time');
ylabel('amplitude'); 1
z=ifft(y); 0
1 1.2 1.4 1.6 1.8 2 2.2 2.4 2.6 2.8 3
figure(); time
stem(abs(z));
title('inbuilt ifft');
xlabel('time');
ylabel('amplitude');
inbuilt ifft
3
2.5
2
amplitude
1.5
0.5
0
1 1.2 1.4 1.6 1.8 2 2.2 2.4 2.6 2.8 3
time
p(n)=p(n)+((x(k)*exp((j*2*pi*(k-1)*(n-1))/N))/N);
end
end
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 34
stem(abs(p));
u-d ifft
title('u-d ifft'); 2
xlabel('time'); 1.8
1.6
ylabel('amplitude');
1.4
1.2
amplitude
1
0.8
0.6
0.4
0.2
0
1 1.2 1.4 1.6 1.8 2 2.2 2.4 2.6 2.8 3
time
clc;
clear;
xdel(winsid());
n=0:10; // Index
x=10*(0.8).^n; // Input Sequence
y=x(pmodulo(-n,length(n))+1); // y is circular shifted sequence of x
scf();
subplot(2,1,1);
bar(x,0.1,'Green');
title('Original Sequence','color','red','fontsize', 4);
xlabel("Index", "fontsize", 2,"color", "blue");
ylabel("Amplitude", "fontsize", 2, "color", "blue");
subplot(2,1,2);
bar(y,0.1,'yellow');
title('Circular Shifted Sequence','color','red','fontsize', 4);
xlabel("Index", "fontsize", 2,"color", "blue");
ylabel("Amplitude", "fontsize", 2, "color", "blue");
X=fft(x,-1); // Discrete Fourier Transform of Original Sequence
Y= fft(y,-1); // Discrete Fourier Transform of Circular Shifted Sequence
scf();
subplot(2,2,1);
bar(n,real(X),0.1,'Green');
title('Real{DFT[x(n)]}','color','red','fontsize', 4);
xlabel("Index", "fontsize", 2,"color", "blue");
ylabel("Amplitude", "fontsize", 2, "color", "blue");
subplot(2,2,2);
bar(n,imag(X),0.1,'Green');
title('Imag{DFT[x(n)]}','color','red','fontsize', 4);
xlabel("Index", "fontsize", 2,"color", "blue");
ylabel("Amplitude", "fontsize", 2, "color", "blue");
subplot(2,2,3);
bar(n,real(Y),0.1,'Green');
title('Real{DFT[x((-n))]}','color','red','fontsize', 4);
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 35
xlabel("Index", "fontsize", 2,"color", "blue");
ylabel("Amplitude", "fontsize", 2, "color", "blue");
subplot(2,2,4);
bar(n,imag(Y),0.1,'Green');
title('Imag{DFT[x((-n))]}','color','red','fontsize', 4);
xlabel("Index", "fontsize", 2,"color", "blue");
ylabel("Amplitude", "fontsize", 2, "color", "blue");
CONCLUSION:
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 36
LAB 6
ANALOG FILTER DESIGN
AIM: To Design and implement an analog filter with given specification.
THEORY:
Analog filters are indispensable in many situations. The front end of most digital signal Processing
devices is an anti-aliasing analog filter that limits the input signal to range of frequencies that the
digital filter can handle.
The design of classical analog filters is based on approximating the magnitude or phase Specification
by polynomials or rational functions.Of the four classical filter types based on magnitude
specifications, the Butterworth filter is Monotonic in the pass band and stop band, the Chebyshev –I
filter displays ripples in the Pass band but is monotonic in the stop band, the Chebyshev –II filter
displays ripples in the stop band but is monotonic in the pass band, and the elliptical filter has ripples
in both bands.
The table below lists the available parameters for each design/band combination. For lowpass and
highpass band configurations, these parameters include the passband edge frequency, the stopband
edge frequencies, the passband ripple Rp,and the stopband attenuation Rs.Forbandpass and
bandstop configurations, the parameters include the lower and upper passband edge frequencies, p1
and p2, the lower and upper stopband edge frequencies, s1 and s2, the passband ripple Rp, and the
stopband attenuation Rs. Frequency values are in rad/s, and ripple and attenuation values are in dB.
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 37
RESPECTIVE MATLAB FUNCTIONS:
FREQZ:
[H,W] = FREQZ(B,A,N) returns the N-point complex frequency response vector H and the N-point
frequency vector W in radians/sample.
[B,A] = BUTTER (N, Wn) designs an Nth order lowpass digital Butterworth filter and returns the filter
coefficients in length N+1 vectors B (numerator) and A (denominator). The coefficients are listed in
descending powers of z. The cutoff frequency Wn must be 0.0 <Wn< 1.0, with 1.0 corresponding to
half the sample rate.
If Wn is a two-element vector, Wn = [W1 W2], BUTTER returns an order 2N bandpass filter with
passband W1 < W < W2.
[N, Wn] = BUTTORD(Wp, Ws, Rp, Rs) returns the order N of the lowest order digital Butterworth filter
that loses no more than Rp dB in the passband and has at least Rs dB of attenuation in the stopband.
Wp and Ws are the passband and stopband edge frequencies, normalized from 0 to 1 (where 1
corresponds to pi radians/sample).
ParameterDescription
Lowpass Wp<Ws
Highpass WP >Ws
FREQS:
Frequency response of analog filters.[h,w] = freqs(b,a,n) uses n frequency points to compute the
frequency response h, where n is a real, scalar value. The frequency vector w is auto-generated and
has length n. If you omit n as an input, 200 frequency points are used. If you do not need the
generated frequency vector returned, you can use the form h = freqs(b,a,n) to return only the
frequency response h.
MATLAB PROGRAMS :
OUTPUT :
b =1.0e+037
Columns 1 through 9 0
0 0 0 0 0 0 0 0 Columns 10
through 11 0 9.5411
a = 1.0e+037 * Columns
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 39
1 through 9 0.0000 0.0000
0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 Columns 10 through
11 0.97 9.5411
Ap = 1db
As = 60db Slp
= 6280 rad/sec Sls =
7536 rad/sec
*n,Wn+ = buttord(6280,7536,1,60,’s’);
OUTPUT :
n = 42 Wn =
6.3931e+003
Fp = 0.4;
Fs = 0.5
Ap = 1;
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 40
As = 80;
h = fdesign.lowpass(Fp,Fs,Ap,As);
OUTPUT:
h =Response: 'Lowpass'
Specification: 'Fp,Fst,Ap,Ast'
Description: {'Passband Frequency';'Stopband Frequency';'Passband Ripple (dB)';'Stopband
Attenuation (dB)'}
NormalizedFrequency: true
Fpass: 0.4
Fstop: 0.5
Apass: 1
Astop: 80
Butter(h);
Cheby1(h);
Cheby2(h);
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 41
4) Design BPBF for given specification.
Fst1 = 0.35;
Fp1 = 0.45;
Fp2 = 0.55;
Fst2 = 0.65;
Ast1 = 60;
Ap = 1;
Ast2 = 60;
k = fdesign.bandpass(Fst1,Fp1,Fp2,Fst2,Ast1.Ap,Ast2);
OUTPUT :
k =Response: 'Bandpass'
Specification: 'Fst1,Fp1,Fp2,Fst2,Ast1,Ap,Ast2'
Cheby2 (k);
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 43
Frequency v/s magnitude graph
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 44
Frequency v/s phase and amplitude combine graph
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 45
Design of low pass IIR filter using FDATOOL
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 46
Frequency v/s phase graph
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 47
Poles and Zeros location
CONCLUSION:
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 48
ASSIGNMENT :
1) Design a BPF with pass band of 1000Hz to 2000Hz with less than 3db of ripple in the pass
band and 80db attenuation in the stopband that are 100Hz wide on both sides of
passband.
2) Design a LPF with a cut-off frequency 1050Hz & plot the output if input is sum of sine
wave of frequency 1000Hz &1500Hz.
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 49
LAB 7
APPLICATIONS OF DSP
(a)AIM :
THEORY:
OBJECTIVE 1:
DTMF is used for telecommunication signaling over analog telephone lines in the voice-frequency
band between telephone handsets and other communications devices and the switching center. The
version of DTMF that is used in push-button telephones for tone dialing is known as Touch-Tone.
MULTI-FREQUENCY:
Multi-frequency signaling is a group of signaling methods that use a mixture of two pure
tone (pure sine wave) sounds. The earliest of these were for in-band signaling between switching
centers, where long-distance telephone operators used a 12-digit keypad to input the next portion of
the destination telephone number in order to contact the next downstream long-distance telephone
operator. This semi-automated signaling and switching proved successful in both speed and cost
effectiveness. Dual-tone multi-frequency (DTMF) signaling was developed for the consumer to signal
their own telephone-call's destination telephone number instead of talking to a telephone operator.
USAGE:
DTMF tones were used at first in the telephone handsets and other communication devices to dial
any numbers.
DTMF tones were used by cable television broadcasters to indicate the start and stop times of local
commercial insertion points during station breaks for the benefit of cable companies.
DTMF tones are also used by some cable television networks and radio networks to signal the local
cable company/network station to insert a local advertisement or station identification.
DTMF signaling tones can also be heard at the start or end of some VHS (Video Home System)
cassette tapes. Information on the master version of the video tape is encoded in the DTMF tone.
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 50
GENERATING DTMF TONES:
The DTMF system uses seven different frequency signals transmitted in pairs to represent 12 different
numbers, symbols and letters. The DTMF keypad is laid out in a 4×3 matrix, with each row
representing a low frequency, and each column representing a high frequency.
Pressing a single key (such as '1' ) will send a sinusoidal tone for each of the two frequencies (697 and
1209 hertz (Hz)). The original keypads had levers inside, so each button activated two contacts. The
multiple tones are the reason for calling the system multifrequency. These tones are then decoded by
the switching center to determine which key was pressed. These frequencies were chosen to prevent
any harmonics from being incorrectly detected by the receiver as some other DTMF frequency. The
frequencies allocated to the push-buttons of the telephone pad are shown below:
697 Hz 1 2 3
770 Hz 4 5 6
852 Hz 7 8 9
941 Hz * 0 #
The tone frequencies, as defined by the Precise Tone Plan, are selected such
that harmonics and intermodulation products will not cause an unreliable signal. No frequency is a
multiple of another, the difference between any two frequencies does not equal any of the
frequencies, and the sum of any two frequencies does not equal any of the frequencies. The
frequencies were initially designed with a ratio of 21/19, which is slightly less than a whole tone. The
frequencies may not vary more than ±1.8% from their nominal frequency, or the switching center will
ignore the signal. The high frequencies may be the same volume as – or louder than – the low
frequencies when sent across the line. The loudness difference between the high and low frequencies
can be as large as 3 decibels(dB) and is referred to as "twist."
for i=1:length(mobile)
switch mobile(i)
case 1
row_f=1;
colum_f=1;
case 2
row_f=1;
colum_f=2;
case 3
row_f=1;
colum_f=3;
case 4
row_f=2;
colum_f=1;
case 5
row_f=2;
colum_f=2;
case 6
row_f=2;
colum_f=3;
case 7
row_f=3;
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 53
colum_f=1;
case 8
row_f=3;
colum_f=2;
case 9
row_f=3;
colum_f=3;
case 0
row_f=4;
colum_f=2;
otherwise
row_f=4;
colum_f=1;
end
y=sin(2*3.14*(row_f1(row_f)/fs)*N)+sin(2*3.14*(colum_f1(colum_f)/fs)*N); %Time
Domain Signal Generation for each Digit
total_signal=[total_signal y zeros(1,8800)];
temp(:,:,i)=y(:,:);
end
figure;
plot(total_signal);
title('DTMF Signal','color','red','fontsize', 10);
sound(total_signal,fs);
OUT PUT:
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 54
%%%% Program 3: (DTMF for the Given Mobile Number & Decoder) %%%%
clc;
close;
clear;
row_f1=[700 770 850 940]; // Row Frequency
colum_f1=[1220 1350 1490]; // Column Frequency
fs=8000; // Sampling Frequency
N=1:800; // Total No. of Samples for each Digit
mobile=[9 9 0 8 4 5 0 6 5 0];
total_signal=[];
figure;
for i=1:length(mobile)
select mobile(i)
case 1
row_f=1;
colum_f=1;
case 2
row_f=1;
colum_f=2;
case 3
row_f=1;
colum_f=3;
case 4
row_f=2;
colum_f=1;
case 5
row_f=2;
colum_f=2;
case 6
row_f=2;
colum_f=3;
case 7
row_f=3;
colum_f=1;
case 8
row_f=3;
colum_f=2;
case 9
row_f=3;
colum_f=3;
case 0
row_f=4;
colum_f=2;
else
row_f=4;
colum_f=1;
end
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 55
y=sin(2*3.14*(row_f1(row_f)/fs)*N)+sin(2*3.14*(colum_f1(colum_f)/fs)*N); //Time Domain Signal
Generation for each Digit
total_signal=[total_signal y zeros(1,8800)];
temp(:,:,i)=y(:,:);
end
plot(total_signal);
title('DTMF Signal','color','red','fontsize', 4);
xlabel("Samples", "fontsize", 2,"color", "blue");
ylabel("Amplitude", "fontsize", 2, "color", "blue");
sound(total_signal,fs);
row_f=[];
col_f=[];
for i=1:10
n=length(temp(:,:,i));
p=abs(fft(temp(:,:,i))); // FFT of Signal of respective Digit
f=(0:n-1)*fs/n; // Total Frequency Range
//plot(f,p);
row=p(2:100); // Row Frequency separation
col=p(101:200); // Column Frequency separation
[r1 c1]=find(row==max(row)); // Finding the location of peak for Row Frequency
[r2 c2]=find(col==max(col)); // Finding the location of peak for Column Frequency
row_f=[row_f 10*c1]; // Array containing peak of Row Freqiency
col_f=[col_f (10*(c2+100))-10]; // Array containing peak of Column Freqiency
end
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 56
end
mobile_find=[mobile_find n0]; // Array containing Decoded Digit of Mobile Number.
end
OUT PUT:
OBJECTIVE 3:
The digital signal processing of audio signals often involves digital filter to create various special
effects such as echo and reverb for compensation for the acoustics of a listening environment, which
are the most important for modern-day studios processing audio signals. In listening space, what we
hear from an audio source consists not only of direct sound, but also early echoes reflected directly
from the walls and other structures.The direct sound provides clues to the location of the source, the
early echoes provide an indication of the physical size of the listening space. The amplitude of the
echoes decays exponentially with time. An echo filter has the form of equation given by:
H(z) = 1 + α * zD
+
∑
Input Output
+
Z-D
An echo filter
This describes FIR filter whose output Y[n] equals to the input X[n] and its delayed (by D samples) and
attenuated (by α) replica of X*n+ (the echo term). Its realization by the block marked z-D. This filter is
also called a Comb filter.
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 57
PROGRAM:
Filter function:
The filter function filters a data sequence using a digital filter which works for both real and complex
inputs. The filter is a direct form II transposed implementationofthestandard difference equation.y =
filter(b,a,x) filters the data in vector ‘x’ with the filter described by numerator coefficient vector b and
denominator coefficient vector a. Here from Direct form II representation of vector ‘b’ we get the
numerator in z-transform as
N(z) = 1 + 0.5z-8000
This shows the delay of 1 second with the power of ‘z’ that is 8000 and the attenuation is given by its
co-efficient 0.5 showing 50% attenuation.
D(z) = 1
Here vector ‘a’ is denominator co-efficient, which is always 1, otherwise it is made 1 by the filter
normalizes its co-efficient to 1. If ‘a’ is 0 then the filter function shows an error.
Wavread function:[y, Fs] = wavread( filename ) loads a WAVE file specified by ‘Filename’, returning
the sampled datain y.
Wavwrite function:wavwrite(y,filename) writes the data stored in the variable y to a WAVE file called
filename. The filename input is a string enclosed in single quotes. The data has a sample rate of 8000
Hz and is assumed to be 16-bit.
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 58
(b)AIM : To study applications of DSP in the field of sound processing and biomedical.
THEORY:
OBJECTIVE 3:
Sound Processing:
Digital signal processing (DSP) technology and its advancements have dramatically impacted our
modern society everywhere. Without DSP, we would not have digital/Internet audio or video; digital
recording; CD, DVD, and MP3 players; digital cameras; digital and cellular telephones; digital satellite
and TV; or wire and wireless networks. DSP’s application in field of sound and biomedical is discussed
below.
DSP can be useful in the field of sound processing. Various sound effects can be created using
MATLAB. MATLAB can read and write sound filles in the .wav format. In many areas of digital signal
processing (DSP) applications—such as communications, speech, and audio processing—rising or
lowering of a sampling rate is required. Speed of the audio signal can be altered with the help of
sampling rate. The speed of a sound signal is increased by downsampling and that reduced by
upsampling the signal.
Downsampling is the process of reducing the sampling rateofasignal. This is usually done to reduce
the data rate or the size of the data. The downsampling factor is usually an integer or a rational
fraction greater than unity. This factor multiplies the sampling time or, equivalently, divides the
sampling rate. For example, if an audio signal at 44,100 Hz is downsampled to 22,050 Hz ,the bit rate
is reduced in half, from 1,411,200 bit/s to 705,600 bit/s. The audio was therefore down sampled by a
factor of 2.
The following code illustrates the down sampling of an audio signal. Here, the speed of audio signal
increases.
%Downsampling ("speed up")
%clear all;
[x, Fs] = wavread('e.wav');
y = resample(x,1,2);
sound(y,Fs)
wavwrite(y,44100,'downsamp_ee.wav')
Upsampling is the process of increasing the sampling rateof a signal. It is just opposite to down
sampling. Here, the upsampling factor multiplies the sampling rate or, equivalently, divides the
sampling period. Thus speed of an audio signal can be reduced by increasing the sampling rate.
Upsampling is illustrated in the following MATLAB code.
% Upsampling ("slow down")
[x, Fs] = wavread('e.wav');
z = resample(x,2,1);
sound(z,44100)
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 59
wavwrite(z,44100,'upsamp.wav')
In sound processing, the audio signal has to be controlled for various frequency components
present. The frequency response of a sound system is corrected so that the frequency balance of the
music as heard through speakers, better matches the original performance picked up by a
microphone. This is done by use of low-cut(high pass) or high-cut(lowpass) filter.
A low-pass filter is an electronic filter that passes low-frequencysignals but attenuates (reduces the
amplitude of) signals with frequencies higher than the cutoff frequency. The following MATLAB code
is used to attenuate the high frequency components of the desired audio file. Here, a fourth order
low pass elliptic filter is designed with a normalized pass band edge frequency 0.15, 5 dB of ripple in
pass band and 80 dB of attenuation in the stop band.
% Lowpass filtering
N = 4;Rp = 5;Rs = 80;
Wn = .15;
[x, Fs] = wavread('e.wav');
[B,A] = ellip(N,Rp,Rs,Wn);
yl= filter(B,A,x);
sound(yl,44100)
wavwrite(yl,44100,'lpf.wav')
A high pass filter is just opposite to a low pass filter. A high pass filter, also called a low-cut filter, or
bass-cut filter when used in audio application, passes high frequency signals but attenuates signals
with lower frequency. For elimination of low frequency sounds the following code is demonstrated in
which a high pass fourth order elliptic filter is designed with a normalized pass band edge frequency
0.15, 5 dB of ripple in pass band and 80 dB of attenuation in the stop band.
% Highpass filtering
N = 4;Rp = 5;Rs = 80;
Wn = .15;
[x, Fs] = wavread('e.wav');
[B,A] = ellip(N,Rp,Rs,Wn,'high');
yh = filter(B,A,x);
sound(yh,44100)
wavwrite(yh,44100,'hpf.wav')
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 60
OBJECTIVE 4:
Medical instruments would be less efficient or unable to provide useful information for precise
diagnoses if there were no digital electrocardiography (ECG) analyzers or digital x-rays and medical
image systems.
Hum noise created by poor power supplies, transformers, or electromagnetic interference sourced by
a main power supply is characterized by a frequency of 50 Hz and its harmonics. If this noise
interferes with a desired audio or biomedical signal (e.g., in electrocardiography [ECG]), the desired
signal could be corrupted. The corrupted signal is useless without signal processing. It is sufficient to
eliminate the 50-Hz hum frequency with its second and third harmonics in most practical
applications.
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 61
The ECG signals interfered by some noise signals, can be generated using MATLAB. The ‘randn’
function of MATLAB can be used to add noise to the signal .the following code demonstrates the
same.
clc;
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 62
close;
clear;
frequency=[240 254 302 320 358.5 380 451 470]; // Corresponding Frequency
fs=8000; // Sampling Frequency
no=8;
N=1:4000; // Total No. of Samples for Each tone
temp=[];
for i=1:no
y=sin(2*3.14*(frequency(i)/fs)*N);
temp=[temp y];
end
length(temp);
sound(temp,fs);
CONCLUSION:
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 63
LAB 8
INTRODUCTION TO CCSTUDIO
AIM: Introduction to CCStudio and study of TI6x architecture through CCS help.
a. To create a simple project using C file.
b. Perform simulator feature: viewing memory and graph.
c. To study TI6x CPU architecture through help.
PROGRAM STATEMENT:
a. Write a program to display a message “Welcome to the world of TI6x” using .c program.
b. Add .asm file, which contains a table with 10 values to generate a sine wave.
REQUIREMENTS:
CCStudio for 6x
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 64
x. create a new .asm file which contains a data to display a sine wave. As we are not to call this
.asm file in the main program, it should be a data file.
xi. Add this file to the project.
xii. Make a change in the .cmd file. The data is defined in the ‘mydata ’ section (a user defined
name). So, we need to declare in the .cmd file that this section should be written in SDRAM area.
xiii. Build and load the project as before. If there is error in each line, upon building, the
reason may be an assembly code requires that all of the lines in the file not start from the first
column. Verify this and modify accordingly. By double clicking on the error message will open the file
and point the cursor at the line where the error is.
xiv. Run it. The output is displayed.
Sample Program 1:
Sample Program 2:
Create a project and Write a program in CCS to print Factorial.
#include<stdio.h>
int main()
{
int n,fac,i;
printf("enter n:");
scanf("%d",&n);
fac=1;
for(i=n;i>1;i--)
{
fac=fac*n;
n--;
}
printf("%d",fac);
return 0;
}
Output:
enter n: 4
24
CONCLUSION:
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 66
LAB 9
Assembly Program in CCS
REQUIREMENTS:
CCStudio for 6x
METHOD:
A. To add .asm file to a project.
i. create a new .asm file which contains a data to display a sine wave. As we
are not to call this .asm file in the main program, it should be a data file.
ii. Add this file to the project.
iii. Make a change in the .cmd file. The data is defined in the ‘mydata ’ section
(a user defined name). So, we need to declare in the .cmd file that this
section should be written in SDRAM area.
iv. Build and load the project as before. If there is error in each line, upon
building, the reason may be an assembly code requires that all of the lines
in the file not start from the first column. Verify this and modify
accordingly. By double clicking on the error message will open the file and
point the cursor at the line where the error is.
v. Run it. The output is displayed.
Sample Program:
#include<stdio.h>
#include<math.h>
main()
{
int t,i;
float n,*p=(float *)0x80000000,*w=(float *)0x90000000;
float f=50;
for(t=0;t<=360;t++)
{
n=sin(2*3.14*f*(float)t);
*p=n;
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 67
if(n>0)
*w=*(p);
else
*w=-n;
w++;
p++;
}
printf("values stored from memory is as below \n");
for (i=0;i<=360;i++)
{
printf("%f\t",*(w+i-360));
}
printf("end");
}
OUTPUT:
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 68
2.Create a project and Write a program in CCS to display half wave sinewave.
#include<stdio.h>
#include<math.h>
main()
{
int t,i;
float n,*p=(float *)0x80000000,*w=(float *)0x90000000;
float f=50;
for(t=0;t<=360;t++)
{
n=sin(2*3.14*f*(float)t);
*p=n;
if(n>0)
*w=*(p);
else
*w=0;
w++;
p++;
}
printf("values stored from memory is as below \n");
for (i=0;i<=360;i++)
{
printf("%f\t",*(w+i-360));
}
printf("end");
}
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 69
OUTPUT:
CONCLUSION:
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 70
LAB 10
Programming Techniques in CCS
AIM: To Perform different programming techniques.
i. C calling assembly function
ii. C calling linear assembly function.
PROGRAM STATEMENT:
a. Write a .C program, calling .asm function to multiply two arrays.
b. Write a .C program to Find Factorial of entered No. using C calling ASM
function(assembly
REQUIREMENTS:
CCStudio for 6x
THEORY about PROGRAMMING TI 6713:
A. General Programming:
In linear assembly programming, syntax of assembly code instructions: ADD, SUB is utilized. But the
operands operands are written as in C. Variables are used to designate the registers. Say,
MPY a, b, prod
ADD prod, sum, sum
Parallel instructions are not valid in a linear assembly program.
Specifying the functional unit, register or NOPs is optional.
B. An alternative to .c or .asm is linear assembly .sa program. An assembler optimizer is used with
linear assembly program to create a .asm program, in much the same way as C compiler is used with
.c to .asm conversion. The assembler optimizer gives better performance than the c compiler
optimizer.
In short, linear assembly code programming provides a compromise between a coding effort and
coding efficiency.
C. Assembler Directives:
.cproc and .endproc:
.cproc is the directive to declare the following section of code as C callable linear assembly function.
It is used always with .endproc, which indicates end of the linear assembly function.
Syntex: label ,cproc a, b, prod
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 72
Where, the label is a name of the procedure and a, b, prod are the variables being passed. All
the input and output parameters being passed must be written after .cproc as we pass parameter to a
C functions.
.reg - The .reg directive allows you to use descriptive names for values that are stored in
registers. The assembly optimizer chooses a register for you such that its use agrees with the
functional units chosen for the instructions that operate on the value.
.reg ahi:alo
ADD a0,ahi:alo,ahi:alo
.def – defines a function
The mixed programming mode is possible where c program can call assembly or linear
assembly functions or assembly program calls an assembly level procedure.
C calling assembly:
An external declaration of an assembly function called within a c program using extern directive is
optional. Say, extern short dotp_assem_func()
:
:
result = dotp_assem_func(ap, bp);
The function name should be defined in .asm using .def directive and the function name should be
preceded by an undescore, which indicates that this is a c callable .asm function. I.e.
.def _dotp_assem_func
The name of the *.c file should not be same as the *.asm file.
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 73
Parameter passing:
The parameters passed through the C program are in terms of variables.
These parameters are available as input parameters to an assembly level procedure through registers
A4, B4, A6, B6, A8,… sequentially.
Same way, the output parameter is always through A4. (Only one retur parameter as per C notation.)
The return address has to be passed through B3.
C calling linear assembly:
Enough has been discussed before
Assembly calling assembly:
The calling assembly program has to be defined as init and correspondingly the first assembly code
line should be given a label init.
Other declaration and parameter passing is in the same way.
System Initialization:
After reset from where the processor should start the execution that has to be informed. Processor
executes an interrupt service routine (ISR) for reset interrupt, where we can write a code to branch
(jump) to the our required program.
If there is a .c program in our project, before we can run a C/C++ program, other than this
initialization, we must create the C/C++ run-time environment. The C/C++ boot routine performs this
task using a function called c_int00. The run-time-support source library, rts.src, contains the source
to this routine in a module called boot.c. That is why, if our project contains .c program then it is
compulsory to add to the project the run time support source library file.
If there is no .c program in our project, then to inform the processor to start the program execution
after reset from our defined init procedure, we have to add a vector.asm file to our project, which
basically is an reset interrupt service routine (ISR) to make a branch (jump) to the required location.
If there is no .c program in our project, before building the project, we must modify the linker option
(Project Options) to select “No Autoinitializtion”. Otherwise, the warning “entry point symbol
_c_int00 undefined” is displayed on building this project with no main() function ion C.
PROGRAM:
[A1] B LOOP
NOP 5
B B3
NOP 5
LOOP: MPY A4,A1,A4 ;accumulate in A4
NOP ;for 1 delay slot with MPY
SUB A1,1,A1 ;decrement for next multiply
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 75
NOP 5 ;five NOPs for delay slots
END
INPUT
INPUT VALUE: 5
OUTPUT
FACTORIAL= 120
CONCLUSION:
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 76
P A R T II
QUESTION PAPERS
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 77
DHARMSINH DESAI UNIVERSITY, NADIAD
FACULTY OF TECHNOLOGY
FIRST SESSIONAL
SUBJECT: (EC611) DIGITAL SIGNAL PROCESSING
Q.4 (a) The difference equation of a discrete time system is given by y(n)-3y(n-1)-4y(n-2) = x(n) + [5]
2x(n-1). Find out impulse response of the system.
(b)
Find out inverse z transform of log 1 az 1 , z > a [2]
(c) State and prove time reversal property of z transform. Using the property find out z [3]
transform of u(-n).
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 78
(d) Find out the ZSR of (i) y(n)-0.8y(n-1)=2 and (ii) y(n)-0.8y(n-1)=0.5 [2]
OR
Q.4 (a) Discuss echo and reverb filters briefly. Design an echo filter to generate echo at 60% [4]
attenuation as compared to original sample and after 1 sec. Assume speech sampling rate of
8KHz.
(b) Classify following on the basis of linearity, causality and time invariance. [3]
i. y(n)=x(-n)+2,
ii. y(n)=x(n)cosnwo
(c) What is the significance of ROC in z transform? [2]
(d) Determine z transform of x n (0.5) u(n) (2) u(n 1)
n n [3]
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 79
DHARMSINH DESAI UNIVERSITY, NADIAD
FACULTY OF TECHNOLOGY
SECOND SESSIONAL
SUBJECT: (EC611) DIGITAL SIGNAL PROCESSING
Examination : B.TECH - Semester - VI Seat No. :
Date : 12/02/2013 Day : Tuesday
Time : 11:30 to 12:45 Max. Marks : 36
INSTRUCTIONS:
1. Figures to the right indicate maximum marks for that question.
2. The symbols used carry their usual meanings.
3. Assume suitable data, if required & mention them clearly.
4. Draw neat sketches wherever necessary.
5. Bold letter in sequence represents n=0 position of sequence.
Q.1 Do as directed.
(a) Following is desired frequency response for design of FIR filter. Derive the expression of [2]
impulse response for the same using Fourier series method.
Hd(ejΩ)
e-j3Ω
(b) What are the advantages of FIR filters? Why? [2]
(c) [2]
Given x[n]= {0,2,4,6} and h[n] = {6,4,2,0}. Find Periodic Convolution.
Q.2 (a) Consider a 2-point averaging filter whose present output equals the average of the present [5]
and previous input. (i) Set up a difference equation for this system. (ii) Give impulse response
for the system.
(iii) Given output of the system is
Q.3 (I) x[n] is IDFT of X[K] = [4 3 2 1]. Sketch the magnitude spectrum against analog frequency if x(n) [2]
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 80
is sampled at 8KHz for 0.5ms. Find DC value and highest frequency in x(n).
(II) Compute N points DFT of following sequences: [2]
a. x*n+ = δ(n-n0 ) and b. y[n] = 2, for even N
(III) Let the Z transform of sequence h[n] be given by . Find inverse z [2]
i. {0, 4, 1, 2}
ii. x(-n)
2. Discuss All pass filters. How do you apply it to convert non minimum phase system to
minimum phase system?
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 81
DHARMSINH DESAI UNIVERSITY, NADIAD
FACULTY OF TECHNOLOGY
THIRD SESSIONAL
SUBJECT: (EC611) DIGITAL SIGNAL PROCESSING
Examination : B.TECH. - Semester - VI Seat No. :
Date : 06/04/2013 Day : Monday
Time : Max. Marks : 36
INSTRUCTIONS:
1. Figures to the right indicate maximum marks for that question.
2. The symbols used carry their usual meanings.
3. Assume suitable data, if required & mention them clearly.
4. Draw neat sketches wherever necessary.
5. Bold letter in sequence represents n=0 position of sequence.
Q.1 Do as directed.
(a) For a band stop filter having edge frequencies of [20,26,36,40] .Find normalized prototype [2]
Frequencies and expression for frequency transformation.
(b) If a signal g[n] has energy E, then the signal g[n/5] has energy of _______. Justify your [2]
answer.
(c) If a signal is given by x[n]. Find its energy. [2]
Q.2 (a) Design a Butterworth bandstop filter with a 2-db passband edges of 30 Hz of 100Hz, and [6]
40dB stopband edges of 50Hz and 70Hz.
(b) What is the use of window in filter design? Design a Lowpass FIR filter with a cutoff [6]
frequency of 5kHz and a sampling frequency of 20kHz using Hann window with N = 7.
OR
Q.2 (a) Design a fourth order Butterworth Bandpass filter with a 2-dB passband of 200Hz and a [6]
centre frequency of f0 = 1KHz.
(b) 1. Check the periodicity of the following signals and find the periods. [3]
(1) x[n] = 5sin(nπ/8 + π/4) – 5cos(nπ/8 – π/4). (2) h[n] = (0.9)n ejnπ/10.
2. Compare IIR and FIR filters. [3]
Q.3 (I) Find transfer function and impulse response of y[n]-0.4y[n-1]=2x[n]. [2]
(II) The first five points of the 8 point DFT of a real valued sequence are X(k)={0.25,0.125- [2]
j0.3,0,0.12-j0.05,0}.Determine the remaining three points. Find X(15) and X(25)
(III) Write difference between Von Neumann architecture and Harvard architecture. [2]
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 82
(b) i. Find whether the following systems are LTI system or not? [6]
1. y[n]= mx[n] +c
2. y[n]=x[-n+1]
ii. Discuss Decimation in Frequency FFT algorithm.
(c) 1. X(z) is a Z transform of x[n] = 2nu(n), Use necessary z transform properties to find signal [6]
Y(z) = X(1/z) and Q(z) = X(2z)
2. If X[k] is sampled version of spectrum of x[n], Show that x[n] is reconstructed from the
X[k].
Department of Electronics & Communication, Faculty of Technology, Dharmsinh Desai University, Nadiad 83