Lab 3a
Lab 3a
Laboratory Exercise 3a
SIGNALS
OBJECTIVE:
EXERCISE:
Task #1: 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 discrete form.
Coding
: f1 =
10
f2 =110; fs = 100; t = 0:0.001:0.2; x1 =
sin(2*pi*f1*t); x2 = sin(2*pi*f2*t);
plot(t,x1,t,x2) n1 = 0: 1/fs: 2/f1; n2 = 0:1/fs:
11/f2; y1 = sin(2*pi*f1*n1); y2 =
sin(2*pi*f2*n2) subplot(3,1,2); stem(n1,y1);
subplot(3,1,3); stem(n2,y2);
Result:
Coding:
n = 0:99; fs = 5000;
for i = 1:4 f = [500
2000 3000 4500 ]
x = sin(2*pi*f(i)*n/fs);
subplot(4,1,i) stem (n,x)
end
Result:
Task #2(b)
Suppose that f=2khz & fs = 50khz
1. 1) plot the signal x(n)
2. 2)plot the signal x(n) created by even number samples of x(n)
Coding: n = 0:99; f
=2000 fs = 50000;
for i = 1:4 f = [500
2000 3000 4500 ]
x = sin(2*pi*f(i)*n/fs);
subplot(4,1,i) stem (n,x)
End
Result:
Conclusion:
OBJECTIVE:
Simulate a discrete-time continuous sinusoid signal with length of the signal be 500.
Choose the significant digits for round-off and apply to the signal above.
Compute error signals and SQNR.
Now choose significant digits for truncation for the same signal given above.
Analyze the difference between round-off and truncation.
TASK#I: Differentiate between mind off and tnmcation and also use
MATLAB help to get familiar with the syntax of both method
Round Off:
help round round rounds towards near—st
decimal or
round (X, N), far positive integers N, rounds to N digits to the right oof the decimal
point. If N is zero, X is round—cl to the nearest integer.
If N is less than X is rounded Of point.
N must be a scalar integer.
round (X, N, 'significant') rounds each Element to its N mast significant digits,
counting from the most—significant or Left side oof the nurrber . N must be a
positive integer scalar .
Tnmcate :
>> help fix fix Round towards
zero.
fix (X) rounds the elements of X to the nearest integers towards zero.
significant digits for round-off and apply to the signal generated above.
Compute the error signals and SQNR.
CODE:
xe=x -xq ;
Px=(1/N)*sin(x.*x);
I/N ) *xe);
sqnr=1Ø*10g(Px/Pe)
OUTPUT:
Enter the value to
zee .2285
TASK#3: For F = 1/50 and length of the signal to be 200, wmite a program
to quantize the signal x (n), using Truncation. Also increase number of
levels by increasing amplitude of the signal. Plot the signals x (n), xq (n)
and eq (n) and also compute the corresponding SQNR.
CODE:
stinr
273.4899
200
200
1; IGwh•lb
TASK#4: Use round off method by using for loop and take significant digits
as input i.e. 1, 2 &3.In each case plot the signals x (n), xq (n) and eq (n)
and also compute the conæsponding
SQNR.
CODE:
subplot (3,
1, 2); stem
(n, xq) ;
xe=x -xq ;
subplot (3,
1, 3); stem
(n, xe) ;
Px=(1/N)*sin(x.*x);
I/N ) *xe);
sqnr=1Ø*10g(Px/Pe)
148 . 9629
200
200
-4
-5 200
OUTPUT #2:
Enter the value to vaantize :
200
-5 200
OUTPUT:
200
# 3:
sclnr —
426.1753
80 12 14 180 2
00
80 12 14 16 200
x10 10
-
80 200
CONCLUSION: