Write a Matlab program to perform Amplitude scaling, Time Scaling and Time Shifting on the signal x(t)= 1+t, for t=0 to t=2.( Imagine arbitrary scaling factor)
close all,
clear all,
clc,
%{
Write a Matlab program to perform Amplitude scaling, Time Scaling and Time Shifting on the signal
x(t)= 1+t, for t=0 to t=2.( Imagine arbitrary scaling factor)
%}
Fs=0.1;
t = 0:Fs:2;
Xt = 1 + t;
scrsz = get(0,'ScreenSize');
Dim=0;
figure('Position',[scrsz(1)+Dim, scrsz(2)+Dim,scrsz(3)-20,scrsz(4)-100]);
subplot(3,2,1);
plot(t,Xt);
title('X(t) = 1 + t for 0<=t<=2','FontSize',14);
xlabel('--- Time (t) ---');
ylabel('--- X(t) --->');
grid on,
AmpScaleFactor = 2;
Xa = AmpScaleFactor*Xt;
subplot(3,2,2);
plot(t,Xa);
s = strcat('Amplitude Scaled Signal: X(t) =',32,32,num2str(AmpScaleFactor),32,'X(t)');
title(s,'FontSize',14);
xlabel('--- Time (t) ---');
ylabel('--- X(t) --->');
grid on,
AmpScaleFactor = 2;
Xa = AmpScaleFactor*Xt;
subplot(3,2,3);
stem(t,Xt);hold on; %original
grid on
TimeScaleFactor=4;
t2 = TimeScaleFactor*t;
subplot(3,2,4);
stem(t2,Xt);
s = strcat('Time Scaled Signal: X(t) at Time Scale Factor = ',32,num2str(TimeScaleFactor));
title(s,'FontSize',14);
xlabel('--- Time (t) ---');
ylabel('--- X(t) --->');
grid on,
subplot(3,2,5);
t1 = -t;
stem(t1,Xt);
s = strcat('Time Shifted: t = -t');
title(s,'FontSize',14);
xlabel('--- Time (t) ---');
ylabel('--- X(t) --->');
grid on,
subplot(3,2,6);
t1 = t+2;
stem(t1,Xt);
s = strcat('Time Shifted: t = t+2');
title(s,'FontSize',14);
xlabel('--- Time (t) ---');
ylabel('--- X(t) --->');
grid on,
Comments
Leave a comment