Sunday, August 28, 2011

Digital Signal Processing Sample Viva Questions

Dear all students,

DSP lab sample viva questions available for download. You can download using username and password on request.

Send request to download the material.

DSP Lab Viva Sample Questions

Tuesday, July 19, 2011

Programs of IIR Filters

Dear All Students,

  Here I am providing the required Matlab Program to execute IIR - Filters i.e. Butterworth, Chebshev Type-I, Chebshev Type-II. Unlike Previously stated, write these programs in some book/paper. Don't write these programs directly in observations. After executing the programs you have to write in observations.

So, the following are the Programs:

1) Butterworth IIR Low-Pass Filter

2) Butterworth IIR High-Pass Filter

3) Chebshev Type-I IIR Low-Pass Filter

4) Chebshev Type-II IIR High-Pass Filter

5) Chebshev Type-II IIR Low-Pass Filter

6) Chebshev Type-II IIR High-Pass Filter

The respective code's are as follows:

IIR Filters

Program 1:

%Program to find frequency respnse of butterworth IIR analog Low-pass Filter

wp=input('enter passband cuttoff frequency:');
ws=input('enter stopband cuttoff frequency:');
rp=input('enter passband ripple in db:');
rs=input('enter stop band ripple in db:');
fs=input('enter the sampling frequency:');
w1=2*wp/fs;
w2=2*ws/fs;
[n,wn]=buttord(w1,w2,rp,rs,'s');
[b,a]=butter(n,wn,'s');
w=0:0.01:pi;
[h,omega]=freqs(b,a,w);
gain=20*log10(abs(h));
an=angle(h);
subplot(2,1,1);
title('magnitude response of LPF');
plot(omega/pi,gain);
xlabel('normalized frequency');
ylabel('phase in radians');
subplot(2,1,2);
title('phase in radians');
plot(omega/pi,an);
xlabel('normalized frequency');
ylabel('phase in radians');

Program 2:

%Program to find frequency respnse of butterworth IIR analog High-pass Filter

wp=input('enter passband cuttoff frequency:');
ws=input('enter stopband cuttoff frequency:');
rp=input('enter passband ripple in db:');
rs=input('enter stop band ripple in db:');
fs=input('enter the sampling frequency:');
w1=2*wp/fs;
w2=2*ws/fs;
[n,wn]=buttord(w1,w2,rp,rs,'s');
[b,a]=butter(n,wn,'high','s');
w=0:0.01:pi;
[h,omega]=freqs(b,a,w);
gain=20*log10(abs(h));
an=angle(h);
subplot(2,1,1);
title('magnitude response of LPF');
plot(omega/pi,gain);
xlabel('normalized frequency');
ylabel('phase in radians');
subplot(2,1,2);
title('phase in radians');
plot(omega/pi,an);
xlabel('normalized frequency');
ylabel('phase in radians');


Program 3:

%Program to find frequency respnse of Chebyshev Type-I IIR analog Low-pass Filter

wp=input('enter passband cuttoff frequency:');
ws=input('enter stopband cuttoff frequency:');
rp=input('enter passband ripple in db:');
rs=input('enter stop band ripple in db:');
fs=input('enter the sampling frequency:');
w1=2*wp/fs;
w2=2*ws/fs;
[n,wn]=cheb1ord(w1,w2,rp,rs,'s');
[b,a]=cheby1(n,wn,'s');
w=0:0.01:pi;
[h,omega]=freqs(b,a,w);
gain=20*log10(abs(h));
an=angle(h);
subplot(2,1,1);
title('magnitude response of LPF');
plot(omega/pi,gain);
xlabel('normalized frequency');
ylabel('phase in radians');
subplot(2,1,2);
title('phase in radians');
plot(omega/pi,an);
xlabel('normalized frequency');
ylabel('phase in radians');


Program 4:

%Program to find frequency respnse of Chebyshev Type-I IIR analog High-pass Filter

wp=input('enter passband cuttoff frequency:');
ws=input('enter stopband cuttoff frequency:');
rp=input('enter passband ripple in db:');
rs=input('enter stop band ripple in db:');
fs=input('enter the sampling frequency:');
w1=2*wp/fs;
w2=2*ws/fs;
[n,wn]=cheb1ord(w1,w2,rp,rs,'s');
[b,a]=cheby1(n,wn,'high','s');
w=0:0.01:pi;
[h,omega]=freqs(b,a,w);
gain=20*log10(abs(h));
an=angle(h);
subplot(2,1,1);
title('magnitude response of LPF');
plot(omega/pi,gain);
xlabel('normalized frequency');
ylabel('phase in radians');
subplot(2,1,2);
title('phase in radians');
plot(omega/pi,an);
xlabel('normalized frequency');
ylabel('phase in radians');

Program 5:

%Program to find frequency respnse of Chebyshev Type-II IIR analog Low-pass Filter

wp=input('enter passband cuttoff frequency:');
ws=input('enter stopband cuttoff frequency:');
rp=input('enter passband ripple in db:');
rs=input('enter stop band ripple in db:');
fs=input('enter the sampling frequency:');
w1=2*wp/fs;
w2=2*ws/fs;
[n,wn]=cheb2ord(w1,w2,rp,rs,'s');
[b,a]=cheby2(n,wn,'s');
w=0:0.01:pi;
[h,omega]=freqs(b,a,w);
gain=20*log10(abs(h));
an=angle(h);
subplot(2,1,1);
title('magnitude response of LPF');
plot(omega/pi,gain);
xlabel('normalized frequency');
ylabel('phase in radians');
subplot(2,1,2);
title('phase in radians');
plot(omega/pi,an);
xlabel('normalized frequency');
ylabel('phase in radians');

Program 6:

%Program to find frequency respnse of Chebyshev Type-II IIR analog High-pass Filter

wp=input('enter passband cuttoff frequency:');
ws=input('enter stopband cuttoff frequency:');
rp=input('enter passband ripple in db:');
rs=input('enter stop band ripple in db:');
fs=input('enter the sampling frequency:');
w1=2*wp/fs;
w2=2*ws/fs;
[n,wn]=cheb2ord(w1,w2,rp,rs,'s');
[b,a]=cheby2(n,wn,'high','s');
w=0:0.01:pi;
[h,omega]=freqs(b,a,w);
gain=20*log10(abs(h));
an=angle(h);
subplot(2,1,1);
title('magnitude response of LPF');
plot(omega/pi,gain);
xlabel('normalized frequency');
ylabel('phase in radians');
subplot(2,1,2);
title('phase in radians');
plot(omega/pi,an);
xlabel('normalized frequency');
ylabel('phase in radians');

Do execute these programs and then write in observations. And get it corrected as early as possible.

with regards,
B V K

Thursday, July 14, 2011

DSP Lab Programs 4,5,6,7,8,9

Dear All Students,

    By now all the batches have done:

Introduction to Matlab
1. Generating Sinusoidal Signals and Performing Summation and finding its harmonics
2. Verifying Linear Convolution
3. Performing N-Point FFT

Those who have not yet completed, complete them by saturday i.e 16-07-2011 and get observations corrected by the mentioned date.

Now I am giving some more programs. Copy them directly in observations and get them to lab and do them in the lab and after doing the experiment get the observations signed.

4. Matlab program to find frequency response of FIR LPF using Rectangular Window

 

Program:

 

n=10;

fp=200;

fr=300;

fs=1000;

fn=2*fp/fs;

window=rectwin(n+1);

b=fir1(n,fn,window);

[h,w]=freqz(b,1,128);

Gain=abs(h);

an=angle(h);

subplot(2,1,1);

plot(w/pi,gain);

title('Normal Magnitude response of LPF');

xlabel('Normalized Frequency');

ylabel('gain in db');

subplot(2,1,2);

plot(w/pi,an);

title('Phase response of LPF');

xlabel('Normalized Frequency');

ylabel('Angle');

 

 

 

5. Matlab Program to find frequency response of FIR Highpass using BLACKMAN window

 

Program:

 

n=10;

fp=200;

fr=300;

fs=1000;

fn=2*fp/fs;

window=blackman(n+1);

b=fir1(n,fn,'high',window);

[h,w]=freqz(b,1,128);

Gain=abs(h);

an=angle(h);

subplot(2,1,1);

plot(w/pi,gain);

title('Normal Magnitude response of HPF');

xlabel('Normalized Frequency');

ylabel('gain in db');

subplot(2,1,2);

plot(w/pi,an);

title('Phase response of HPF');

xlabel('Normalized Frequency');

ylabel('Angle');

 

 

6. Matlab Program to find frequency Response of FIR LPF using Blackman Window

 

Program:

 

n=10;

fp=200;

fr=300;

fs=1000;

fn=2*fp/fs;

window=blackman(n+1);

b=fir1(n,fn,window);

[h,w]=freqz(b,1,128);

Gain=abs(h);

an=angle(h);

subplot(2,1,1);

plot(w/pi,gain);

title('Normal Magnitude response of LPF');

xlabel('Normalized Frequency');

ylabel('gain in db');

subplot(2,1,2);

plot(w/pi,an);

title('Phase response of LPF');

xlabel('Normalized Frequency');

ylabel('Angle');

 

7. Matlab Program to find frequency response of FIR LPF using Hamming Window

 

n=10;

fp=200;

fr=300;

fs=1000;

fn=2*fp/fs;

window=hamming(n+1);

b=fir1(n,fn,window);

[h,w]=freqz(b,1,128);

Gain=abs(h);

an=angle(h);

subplot(2,1,1);

plot(w/pi,gain);

title('Normal Magnitude response of LPF');

xlabel('Normalized Frequency');

ylabel('gain in db');

subplot(2,1,2);

plot(w/pi,an);

title('Phase response of LPF');

xlabel('Normalized Frequency');

ylabel('Angle');

 

 

8. Matlab Program to find frequency response of FIR LPF using Hanning Window

 

n=10;

fp=200;

fr=300;

fs=1000;

fn=2*fp/fs;

window=hann(n+1);

b=fir1(n,fn,window);

[h,w]=freqz(b,1,128);

Gain=abs(h);

an=angle(h);

subplot(2,1,1);

plot(w/pi,gain);

title('Normal Magnitude response of LPF');

xlabel('Normalized Frequency');

ylabel('gain in db');

subplot(2,1,2);

plot(w/pi,an);

title('Phase response of LPF');

xlabel('Normalized Frequency');

ylabel('Angle');

 

9. Matlab Program to find frequency response of FIR LPF using Triangular Window

 

n=10;

fp=200;

fr=300;

fs=1000;

fn=2*fp/fs;

window=triang(n+1);

b=fir1(n,fn,window);

[h,w]=freqz(b,1,128);

Gain=abs(h);

an=angle(h);

subplot(2,1,1);

plot(w/pi,gain);

title('Normal Magnitude response of LPF');

xlabel('Normalized Frequency');

ylabel('gain in db');

subplot(2,1,2);

plot(w/pi,an);

title('Phase response of LPF');

xlabel('Normalized Frequency');

ylabel('Angle');

 

Write the Programs in the Observations and get it signed after doing in the lab.

By next week end everyone should complete these programs.


with regards,

B V K

 

Saturday, July 9, 2011

First Three Matlab Programs of DSP Lab

Dear All Students,

   I am uploading the first three programs of DSP Lab which you have to do on this monday. You should have these programs in your book( not observations book). Try to copy the code in some book and try the code on monday's lab and try to observe the results. If results are okay then do copy in observations and get it signed on monday only.

Instructions to write observations: 
On Right Side of the Observations:
a) you have to mention AIM 
b) Then mention software required(if version of the software is known then mention it)
c) Then follows Program Code
d) Write the Result

On Left Side of the Observations:
a) show the output result.(If any figures are there then u have to draw it neatly and clearly and it should be also drawn on Graph Sheet.)
b) Write the Result with Pencil only.

These are few Instructions.

Below follows the Matlab code for 1) Generating Sinusoidal Signals and finding Summation, 2) Linear Convolution, 3) N-Point FFT Calculation.


1.Matlab code to generate sum of sinusoidal signals

 

Title('sum of sine waves');

t=0:0.5:2*pi;

y=sin(t);

subplot(4,2,1)

stem(y)

xlabel('n');

ylabel('amplitude');

title('sinewave');

subplot(4,2,2);

plot(y);

xlabel('n');

ylabel('amplitude');

title('sinewave');

y1=sin(t)+5*sin(2*t);

subplot(4,2,3);

xlabel('n');

ylabel('amplitude');

title('sinewave with harmonics');

subplot(4,2,4);

stem(y1);

xlabel('n');

ylabel('amplitude');

title('sinewave with harmonics');

y2=sin(t)+5*sin(2*t)+10*sin(3*t);

subplot(4,2,5);

stem(y2);

xlabel('n');

ylabel('amplitude');

title('sinewave with two harmonics');

subplot(4,2,6);

plot(y2);

xlabel('n');

ylabel('amplitude');

title('sine wave with two harmonics');

y3=sin(t)+5*sin(2*t)+10*sin(3*t)+15*sin(4*t);

subplot(4,2,7);

stem(y3);

xlabel('n');

ylabel('amplitude');

title('sinewave with three harmonics');

subplot(4,2,8);

plot(y3);

xlabel('n');

ylabel('amplitude');

 

2.Matlab Program to verify Linear Convolution

 

x=input('Enter Input Sequence:');

y=input('Enter Impulse Response:');

y=conv(x,h);

subplot(3,1,1);

stem(x);

ylabel('amplitude');

xlabel('a');

title('input signal');

subplot(3,1,2);

stem(h);

ylabel('amplitude');

xlabel('b');

title('Impulse Response');

subplot(3,1,3);

stem(y);

ylabel('amplitude');

xlabel('c');

title('Linear Convolution');

disp('The Resultant Signal is:');

disp(y)

 

3.Matlab Program to find N-Point fft of a sequence

 

x=input('Enter the Sequence:');

n=input('Enter the Length of FFT:');

y=fft(x,n);

subplot(2,1,1);

stem(x);

title('Input Sequence');

xlabel('time index n');

ylabel('Amplitude');

subplot(2,1,2);

stem(y);

title('output sequence');

xlabel('frequency index');

ylabel('amplitude');


with regards,

B V K

Saturday, July 2, 2011

DSP Lab Experiments


Source: JNTUH 4-1 ECE Syllabus Book

Branch: ECE Subject Code: 07A70492 Academic Year: 2011-12 Regulation: R07 Year: IV Semester: I
DIGITAL SIGNAL PROCESSING LAB

TOP

LIST OF EXPERIMENTS :

1. To study the architecture of DSP chips � TMS 320C 5X/6X Instructions.

2. To verify linear convolution.

3. To verify the circular convolution.

4. To design FIR filter (LP/HP) using windowing technique

a) Using rectangular window

b) Using triangular window

c) Using Kaiser window

5. To Implement IIR filter (LP/HP) on DSP Processors

6. N-point FFT algorithm.

7. MATLAB program to generate sum of sinusoidal signals.

8. MATLAB program to find frequency response of analog LP/HP filters.

9. To compute power density spectrum of a sequence.

10. To find the FFT of given 1-D signal and plot.