In: Computer Science
% Illustration of Aliasing Effect in the Time-Domain
clf;
T = 0.1;f = 13;
n = (0:T:1)';
xs = cos(2*pi*f*n);
t = linspace(-0.5,1.5,500)';
ya = sinc((1/T)*t(:,ones(size(n))) -
(1/T)*n(:,ones(size(t)))')*xs;
plot(n,xs,'o',t,ya);grid;
xlabel('Time, msec');ylabel('Amplitude');
title('Reconstructed continuous-time signal y_{a}(t)');
axis([0 1 -1.2 1.2]);
a. Run the program to generate both the discrete-time signal
x[n] and its
continuous-time equivalent ya(t), and display them.
b. What is the range of t and the value of the time increment in
the program?
What is the range of t in the plot? Change the range of t so as to
display the
full range ya(t) being computed in the above program and run it
again.
Comment on the plot generated after this change.
Please UPVOTE my answer if you find this explaination to be helpful !!
SOLUTION
part a:
CODE:
clf; clc; close all; clear all;
T = 0.1; f = 13;
n = (0:T:1)';
xs = cos(2*pi*f*n);
t = linspace(-0.5,1.5,500)';
ya = sinc((1/T)*t(:,ones(size(n))) - (1/T)*n(:,ones(size(t)))')*xs;
% subplot(211)
plot(n,xs,'o',t,ya);
grid on;
xlabel('Time, msec');
ylabel('Amplitude');
title('Reconstructed time signal y(a)(t)');
axis([0 1 -1.2 1.2]);
legend('x(n)','y(t)')
OUTPUT SCREEN:
part b:
The range of t is defined in following line:
t = linspace(-0.5,1.5,500)';
The range of t is from -0.5 to 1.5 with increment of 0.0040 or we can also say that there are 500 samples used
Now increasing the range of t but keeping the number of samples equal to 500
CODE:
clf; clc; close all; clear all;
T = 0.1; f = 13;
n = (0:T:1)';
xs = cos(2*pi*f*n);
t = linspace(-0.5,1.5,500)';
ya = sinc((1/T)*t(:,ones(size(n))) - (1/T)*n(:,ones(size(t)))')*xs;
subplot(211)
plot(n,xs,'o',t,ya);
grid on;
xlabel('Time, msec');
ylabel('Amplitude');
title('Reconstructed time signal y(a)(t) for t =[-.5,1.5]');
axis([0 1 -1.2 1.2]);
legend('x(n)','y(t)')
t = linspace(-10,10,500)';
ya = sinc((1/T)*t(:,ones(size(n))) - (1/T)*n(:,ones(size(t)))')*xs;
subplot(212)
plot(n,xs,'o',t,ya);
grid on;
xlabel('Time, msec');
ylabel('Amplitude');
title('Reconstructed time signal y(a)(t)for t =[-10,10]');
axis([0 1 -1.2 1.2]);
legend('x(n)','y(t)')
OUTPUT SCREEN:
Please UPVOTE my answer if you find this explaination to be helpful !!