In: Electrical Engineering
Plot the signal s(t) = cos(2πt), and then illustrate the resulting samples with the following sampling intervals: [30 points] •
Ts= 0.5 sec. •
Ts= 0.75 sec •
Ts =1 sec.
(a) For each case, also sketch the reconstructed continuous time signal from the samples using linear interpolation (i.e. connecting samples by straight lines).
(b) In which case the sampled signal has aliasing distortion? What is the minimal sampling frequency and the corresponding sampling interval needed to avoid aliasing?
Solution:
(a) Matlab code is developed to plot the signals with the following sampling periods
Ts = 0.5sec
Ts = 0.75sec
Ts = 1sec.
clear all;
clc;
f = 1; %1hz
T = 1/f; %time period
t = 0:0.000001:4; %t vector declaration
N=length(t); %length of sequence
theta = (0/180)*pi;
y = cos(2*pi*f*t+theta); %y declaration
figure(1); %figure
subplot(2,2,1); %subplot
plot(t,y);
grid on;
title('Sin plot');
xlabel ('time');
ylabel ('Amp');
%sampling time
% fs = 16e3;
Ts = 0.5; %2msec
n=1:((T)*4)/Ts;
t1 = n*Ts;
% n = n*Ts;
y1 = cos(2*pi*f*n*Ts+theta);
% hold on;
subplot(2,2,2);
plot(t1,y1);
xlim([0 4]);
grid on;
title('dicrete signal sn signal');
xlabel ('time');
ylabel ('Amp');
%%%%for sampling Ts = 0.75sec
Ts = 0.75; %2msec
n=1:((T)*4)/Ts;
t1 = n*Ts;
% n = n*Ts;
y2 = cos(2*pi*f*n*Ts+theta);
% hold on;
subplot(2,2,3);
plot(t1,y2);
xlim([0 4]);
grid on;
title('dicrete signal sn signal');
xlabel ('time');
ylabel ('Amp');
%%%%for sampling Ts = 1sec
Ts = 1; %2msec
n=1:((T)*4)/Ts;
t1 = n*Ts;
% n = n*Ts;
y2 = cos(2*pi*f*n*Ts+theta);
% hold on;
subplot(2,2,4);
plot(t1,y2);
xlim([0 4]);
grid on;
title('dicrete signal sn signal');
xlabel ('time');
ylabel ('Amp');
%%%%end of the code
Plotted waveforms:
(b) As per the nyquist theorem, sampling period is twice the period of the signal.
for Ts = 0.5, sampling theorem is valid and signal can be reconstructed.
for Ts = 0.75, sampling theorem is not valid and signal can not be reconstructed and aliasing effect will be present.
for Ts = 1, sampling theorem is not valid and signal can not be reconstructed and aliasing effect will be present.