0% found this document useful (0 votes)
12 views

Lab No 02 (DSP) Tariq KAMAL (18) LAB TASK . Plotting The Following Programs and Generate Its RESPONSE

The document describes a lab assignment completed by Tariq Kamal involving plotting various digital signal processing programs and generating their responses. The programs include: 1. Plotting a 0.5 amplitude signal shifted to the right by 3 samples 2. Plotting a signal with an amplitude of 1 shifted to sample 325 3. Plotting the signal x3(n)=3.6$(n-6)+2.4$(n+4) 4. Plotting a signal that is 1 from samples -10 to 0 and -1 from samples 7 to 20 5. Plotting the function x=cos(w*n) for various values of w

Uploaded by

Tariq Khan
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Lab No 02 (DSP) Tariq KAMAL (18) LAB TASK . Plotting The Following Programs and Generate Its RESPONSE

The document describes a lab assignment completed by Tariq Kamal involving plotting various digital signal processing programs and generating their responses. The programs include: 1. Plotting a 0.5 amplitude signal shifted to the right by 3 samples 2. Plotting a signal with an amplitude of 1 shifted to sample 325 3. Plotting the signal x3(n)=3.6$(n-6)+2.4$(n+4) 4. Plotting a signal that is 1 from samples -10 to 0 and -1 from samples 7 to 20 5. Plotting the function x=cos(w*n) for various values of w

Uploaded by

Tariq Khan
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 5

LAB NO 02

(DSP)

TARIQ

KAMAL (18)
LAB TASK.
PLOTTING THE FOLLOWING PROGRAMS AND GENERATE ITS
RESPONSE.

am
plitude

(a)%signal x1 step shift to right side n-3


n=0:20;%rang of n samples
x1=zeros(size(n));% make the amplitude of each sample zero
ind=find(n==3)% find 3rd index
x1(ind)=0.5;% give amplitude
figure(1);
0
.5
*
a
m
p
litu
d
e
0
.5
stem(n,x1);
0
.4
5
grid on;
0
.4
xlabel('n-axis');
0
.3
5
ylabel('amplitude');
0
.3
title('0.5*amplitude');
0
.2
5
Graph.
0
.2
0
.1
5
0
.1
0
.0
5
0
0

Graph

a
m
p
litu
d
e

b)shift of 325
n2=250:350;
x2=zeros(size(n2));% it will give all the zero
ind=find(n2==325)
x2(ind)=1;
figure(2);
stem(n2,x2);
grid on;
1
xlabel('n-axis');
0
.
9
ylabel('amplitude');
0
.
8
title('1*amplitude'

1
0
n
-a
x
is

1
2

1
4

1
6

1
8

2
0

1
*
a
m
p
l
i
t
u
d
e

0
.
7
0
.
6
0
.
5
0
.
4
0
.
3
0
.
2
0
.
1
0
2
5
0

2
6
0

2
7
0

2
8
0

2
9
0

3
0
0
n
a
x
i
s

3
1
0

3
2
0

3
3
0

UNIVERSITY OF ENGINEERING AND TECHNOLOGY ABBOTTABAD CAMPUS


DATED: 20 SEP.2011

3
4
0

3
5
0

LAB NO 02

(DSP)

TARIQ

KAMAL (18)

(c) x3(n)=3.6$(n-6)+2.4$(n+4)

1
*a
m
p
litu
d
e

amplitude

n3=-12:8;
x3=zeros(size(n3));% it will give all the zero
4
ind=find(n3==6)
x3(ind)=3.6;
3
.5
x4=zeros(size(n3));
3
ind=find(n3==-4);
2
.5
x4(ind)=2.4;
x5=x3+x4;
2
figure(3);
Graph
1
.5
stem(n3,x5);
1
grid on;
xlabel('n-axis');
0
.5
ylabel('amplitude');
0
-1
2
-1
0
-8
title('1*amplitude')

-6

-4

-2
n
-a
xis

(d)n4=-10:20;

x6=zeros(size(n4));% it will give all the zero


ind=find(-10<=n4&n4<=0);
x6(ind)=1;
x7=zeros(size(n4));
ind=find(n4>=7);
x7(ind)=1;
x8=x6-x7;
figure(4);
stem(n4,x8);
grid on;
xlabel('n-axis');
ylabel('amplitude');
title('1*amplitude')

1
*
a
m
p
l
i
t
u
d
e

0
.
8
0
.
6
a
m
p
litu
d
e

Graph.

0
.
4
0
.
2
0
0
.
2
0
.
4
0
.
6
0
.
8
1
1
0

5
n
a
x
i
s

1
0

UNIVERSITY OF ENGINEERING AND TECHNOLOGY ABBOTTABAD CAMPUS


DATED: 20 SEP.2011

1
5

2
0

LAB NO 02

(DSP)

TARIQ

KAMAL (18)

Plot the function x=cos(w*n) for the following values of w.


n=0:3:50
w=0
x=cos(w.*n)
subplot(4,3,1)
stem(n,x)
xlabel('n-axis')
ylabel('amplitude')
title('for w=0')
grid on

n=0:3:50
w=pi/16
x=cos(w.*n)
subplot(4,3,2)
stem(n,x)
xlabel('n-axis')
ylabel('amplitude')
title('for w=pi/16')
grid on
n=0:3:50
w=pi/8
x=cos(w.*n)
subplot(4,3,3)
stem(n,x)
xlabel('n-axis')
ylabel('amplitude')
title('for w=pi/8')
grid on
n=0:3:50
w=pi/4
x=cos(w.*n)
subplot(4,3,4)
stem(n,x)
xlabel('n-axis')
ylabel('amplitude')
title('for w=pi/4')
grid on

GRAPH..

GRAPH

GRAPH

GRAPH

UNIVERSITY OF ENGINEERING AND TECHNOLOGY ABBOTTABAD CAMPUS


DATED: 20 SEP.2011

LAB NO 02

(DSP)

KAMAL (18)

n=0:3:50
w=pi/2
x=cos(w.*n)
subplot(4,3,5)
stem(n,x)
xlabel('n-axis')
ylabel('amplitude')
title('for w=pi/2')
grid on

n=0:3:50
w=pi
x=cos(w.*n)
subplot(4,3,6)
stem(n,x)
xlabel('n-axis')
ylabel('amplitude')
title('for w=pi')
grid on

GRAPH

GRAPH

n=0:3:50
w=15*pi/8
x=cos(w.*n)
subplot(4,3,7)
GRAPH
stem(n,x)
xlabel('n-axis')
ylabel('amplitude')
title('for w=15*pi/16')
grid on
n=0:3:50
w=15*pi/8
x=cos(w.*n)
subplot(4,3,8)
GRAPH
stem(n,x)
xlabel('n-axis')
ylabel('amplitude')
title('for w=15*pi/8')
grid on
UNIVERSITY OF ENGINEERING AND TECHNOLOGY ABBOTTABAD CAMPUS
DATED: 20 SEP.2011

TARIQ

LAB NO 02

(DSP)

KAMAL (18)

n=0:3:50
w=7*pi/4
x=cos(w.*n)
subplot(4,3,9)
stem(n,x)
xlabel('n-axis')
ylabel('amplitude')
title('for w=7*pi/4')
grid on
n=0:3:50
w=3*pi/2
x=cos(w.*n)
subplot(4,3,10)
stem(n,x)
xlabel('n-axis')
ylabel('amplitude')
title('for w=3*pi/2')
grid on
n=0:3:50
w=2*pi
x=cos(w.*n)
subplot(4,3,11)
stem(n,x)
xlabel('n-axis')
ylabel('amplitude')
title('for w=2*pi')
grid on

GRAPH

GRAPH

GRAPH

UNIVERSITY OF ENGINEERING AND TECHNOLOGY ABBOTTABAD CAMPUS


DATED: 20 SEP.2011

TARIQ

You might also like