Lab S3: Task 01

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 5

2008-EE-094

LAB S3
TASK 01
OBJECT:
Plot two CT signals of 10 Hz and 110 Hz for 0 < t < 0.2 secs. Sample at Fs = 100 Hz and plot them in a discrete
form.

CODING:
f1=10
f2=110
fs=100
t=0:1/1000:0.2
x1=cos(2*pi*f1*t)
x2=cos(2*pi*f2*t)
figure;
plot(t,x1,t,x2,'linewidth',2)
legend('10hz','110hz')
n=0:1/fs:0.2
x3=cos(2*pi*f1*n)
x4=cos(2*pi*f2*n)
figure;
subplot(2,1,1)
stem(n,x3)
title('DISCRETE PLOT OF x1')
subplot(2,1,2)
stem(n,x4)
title('DISCRETE PLOT OF x2')
figure;
plot(t,x1,t,x2,'linewidth',1)
legend('10hz','110hz')
hold on;
stem(n,x3)
DISCRETE PLOT OF x1
GRAPH: 1

1
1 0.5 10hz
110hz
10hz
0.8
110hz
0.8
0
0.6
0.6
-0.5
0.4
0.4

0.2 -1
0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.2
0.2

0
0 DISCRETE PLOT OF x2
1
-0.2
-0.2
0.5
-0.4
-0.4

-0.6 0
-0.6

-0.8 -0.5
-0.8

-1
0
-1 0.02 -1 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.2
0 0.02 0 0.04 0.020.06 0.040.08 0.06 0.1 0.08 0.12 0.1 0.14 0.12 0.16 0.14 0.18 0.16 0.2 0.18 0.2
2008-EE-094

LAB S3
TASK 02a
OBJECT:
For a CT signal: x(t) = sin (2 pi Fo t) whose sampled version will be: x(n) = sin (2 pi Fo/Fs n) where n is a set of
integers and sampling interval Ts=1/Fs.
a)Plot the signal x (n) for n = 0 to 99 for Fs = 5 kHz and Fo = 0.5, 2, 3 and 4.5 kHz. Explain the similarities and
differences among various plots.

CODING:
clc
n=0:99
Fs=50
Fo=input('ENTER THE FREQUENCY Fo:')
x=sin(2*pi*(Fo/Fs)*n)
stem(n,x)

GRAPH:
AT Fs= .5KHZ:
1

0.8

0.6

0.4

0.2

-0.2

-0.4

-0.6

-0.8

-1
0 10 20 30 40 50 60 70 80 90 100
2008-EE-094

OUTPUT:
Fs = 50000
ENTER THE FREQUENCY Fo: 500
Fo = 500

AT Fs= 2KHZ:
1

0.8

0.6

0.4

0.2

-0.2

-0.4

-0.6

-0.8

-1
0 10 20 30 40 50 60 70 80 90 100

OUTPUT:
Fs = 50000
ENTER THE FREQUENCY Fo:2000
Fo = 2000
2008-EE-094

AT Fs= 3KHZ:
1

0.8

0.6

0.4

0.2

-0.2

-0.4

-0.6

-0.8

-1
0 10 20 30 40 50 60 70 80 90 100

OUTPUT:
Fs = 50000
ENTER THE FREQUENCY Fo: 3000
Fo = 3000

AT Fs= 4.5KHZ:
1

0.8

0.6

0.4

0.2

-0.2

-0.4

-0.6

-0.8

-1
0 10 20 30 40 50 60 70 80 90 100
2008-EE-094

LAB S3
TASK 02b
OBJECT:
For a CT signal: x(t) = sin (2 pi Fo t) whose sampled version will be: x(n) = sin (2 pi Fo/Fs n) where n is a set of
integers and sampling interval Ts=1/Fs.
(a) Suppose that Fo = 2 kHz and Fs = 50 kHz.
a. Plot the signal x (n).
b. Plot the signal y (n) created by taking the even numbered samples of x (n). Is this a sinusoidal signal?
Why or why not? If so, what is the frequency?

CODING:
fo=2000;
fs=50000;
n=0:1:99
y=sin(2*pi*fo/fs*n);
figure;
stem(n,y)
title('x(n)')
ne=0:2:99;
y1=sin(2*pi*fo/fs*ne);
figure;
stem(ne,y1)
title('EVEN NUMBERED SAMPLES OF x(n)')

GRAPH:
x(n)
1

0.8

0.6 EVEN NUMBERED SAMPLES OF x(n)


1

0.4
0.8

0.2
0.6

0
0.4

-0.2
0.2

-0.4
0

-0.6
-0.2

-0.8
-0.4

-1
0 10 -0.6 20 30 40 50 60 70 80 90 100

-0.8

-1
0 10 20 30 40 50 60 70 80 90 100

You might also like