Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
5 views

Lab 1

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Lab 1

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Lab session 1

1. Consider the following CT signal:


x(t) = sin (2 pi F0 t). The sampled version will be:
x(n) = sin (2 pi F0/Fs n),
where n is a set of integers and sampling interval Ts=1/Fs.
Plot the signal x(n) for n = 0 to 99
for Fs = 5 kHz and F1 = 0.5, 2, 3 and 4.5 kHz. Explain the similarities and differences
among various plots.

Matlab Code:
close all, clear all, clc;
Fs = 5000, Ts = 1/Fs;
f = [500,2000,3000,4500] %initializing an array to observe output at different
frequencies
figure,
for i = 1:length(f) %initializing for loop for multiple CTCV plots
F = f(i);
t = [0:0.000005:0.2];
xt = sin(2*pi*F*t);
hold on
subplot(2,2,i);
plot(t,xt,'LineWidth',2)
xlabel('Time(sec)'), ylabel('Amp'), xlim([0 0.005]), grid on;
title('CTCV Sinusoid');
end
hold off
figure,
for i = 1:length(f) %initializng another for loop for DTDV plots
F = f(i);
nTs = [0:Ts:0.02]; %sampling of CTCV signal
n = [1:length(nTs-1)]; %array for DTDV
xn = sin(2*pi*F*nTs);
hold on
subplot (2,2,i);
stem (nTs, xn, 'LineWidth',2); %function for DT plot
title ('DTDV'), xlim([0 0.005]);
grid on, xlabel('Discrete time (samples/cycle)'), ylabel('Amp');
end
hold off
Similarities:
Plot 1 looks exactly similar to the plot 4 while plot 2 looks similar to the plot 3 in the discrete time.

Dissimilarities:
If we observe the plots in continuous time, Plot 1 and plot 4 are distinct while plot 2 and plot 3 are also
distinct which is contrary to what observed in discrete time.

Comments: It can be said that the frequencies of 3000Hz and 4500Hz are under-sampled since Fs =
5000Hz and does not match the Nyquist’s criteria i.e. Fs>=2F. Therefore, Plot 4 and plot 3 looks like an
aliased version of plot 1 and plot 2 respectively.
2. Generate a tone in MATLAB with varying frequency f = 1000,2000,3000,4000, 5000,
6000, 8000, 9000, 25000,-1000,-2000,-3000 Hz with Fs = 8000 samples/sec. Listen to
the tones, and observe at Sounds like what frequency? Also Specify whether Aliasing is
happening or not.

Matlab Code:
clear all, close all, clc;
F = -3000; %Differrent frequencies are placed here to observe different
sampled sounds
Fs = 8000, Ts = 1/Fs;
nTs = [0:Ts:1];
x = cos(2*pi*F*nTs);
sound(x);

Comments:
Unique sounds were observed at frequencies ranging from 1kHz - 4kHz. The negative
frequencies also produced the same sound as positive frequencies verifying the Nyquist’s
criteria of –Fs/2. 7kHz, 9kHz and 25kHz were an aliased version of 1kHz while 6kHz of 2kHz and
5kHz of 3kHz. 8kHz did not produce a sound at all because it is an alias of 0Hz which represents
a DC value.
3. Record a sentence in your voice.(you may use Simulink /audacity to record).Change Fs
=44100, 22050, 11025, 8192, 4096 , 2048 , 1024 and observe
a) Voice quality during playback [Excellent/Good/OK/Bad]
b) File size in kilobytes
c) Aliasing happening or not?
Using DSP system tool box in Simulink observing my voice at different sampling rates

Sampling Voice Quality File Size Aliasing?


Frequency (Hz) (KB)
44100 Excellent 648 No
22050 Good 342 No
11025 Ok 176 No
8192 Ok 132 No
4096 Bad 68 Yes
2048 Bad 36 Yes
1024 Bad 20 Yes

You might also like