Practical No 2
Practical No 2
2
Aim: Operations on Signals
Batch- A4
UID- 2023201001
Table of Contents
Aim: Operations on Signals ..................................................................................................................................... 1
Part A........................................................................................................................................................................1
Signal Generation..................................................................................................................................................... 1
Amplitude Scaling..................................................................................................................................................... 3
Amplitude Up Scaling........................................................................................................................................... 3
Amplitude Down Scaling.......................................................................................................................................4
Time Scaling ......................................................................................................................................................... 5
Time Scaling (Expansion) ....................................................................................................................................6
Time Scaling (Compression) ............................................................................................................................... 7
Time Reversal/Folding.............................................................................................................................................. 8
Time Shifting...........................................................................................................................................................10
Time Shifting (Delay).......................................................................................................................................... 11
Time shifting (Advancing)................................................................................................................................... 12
Part B......................................................................................................................................................................13
Conclusion.............................................................................................................................................................. 17
Part A
Signal Generation
a= 0:1 %UID mentioned 001
a = 1×2
0 1
b= 2:12
b = 1×11
2 3 4 5 6 7 8 9 10 11 12
c= 13:18
c = 1×6
13 14 15 16 17 18
t= 0:30
1
t = 1×31
0 1 2 3 4 5 6 7 8 9 10 11 12
a1= a
a1 = 1×2
0 1
b1= square(b)
b1 = 1×11
1 1 -1 -1 -1 1 1 1 -1 -1 -1
c1= cos(c)
c1 = 1×6
0.9074 0.1367 -0.7597 -0.9577 -0.2752 0.6603
c2= exp(c1)
c2 = 1×6
2.4780 1.1465 0.4678 0.3838 0.7594 1.9354
title("Custom Signal")
xlabel("Time")
ylabel("Amplitude")
2
Amplitude Scaling
Theory:
The process of rescaling the amplitude of a signal, i.e., the amplitude of the signal is either amplified or
attenuated, is known as amplitude scaling. In the amplitude scaling operation on signals, the shape of the
resulting signal remains the as that of the original signal but the amplitude is altered (i.e., increased or
decreased).
y(�) = � �(�)
Where, A is a constant. If the value of A is greater than 1 (i.e., A > 1), the signal amplitude scaling is called the
amplification of the signal while if A < 1, then the scaling is called the attenuation of the signal.
Amplitude Up Scaling
a1_a_up= a
a1_a_up = 1×2
0 1
b1_a_up= square(b)
b1_a_up = 1×11
1 1 -1 -1 -1 1 1 1 -1 -1 -1
c1_a_up= cos(c)
c1_a_up = 1×6
0.9074 0.1367 -0.7597 -0.9577 -0.2752 0.6603
c2_a_up= exp(c1)
c2_a_up = 1×6
2.4780 1.1465 0.4678 0.3838 0.7594 1.9354
3
d1_a_up = 1×25
0 1.0000 1.0000 1.0000 -1.0000 -1.0000 -1.0000 1.0000
plot(t(1:length(d1_a_up)),5*d1_a_up,'red')
hold on;
plot(t(1:length(d1)), d1,'blue')
hold off;
title("Amplitude Up Scaling")
xlabel("Time")
ylabel("Amplitude")
legend('Up Scaled','Orignal')
a1_a_dw = 1×2
0 1
b1_a_dw= square(b)
b1_a_dw = 1×11
1 1 -1 -1 -1 1 1 1 -1 -1 -1
c1_a_dw= cos(c)
c1_a_dw = 1×6
0.9074 0.1367 -0.7597 -0.9577 -0.2752 0.6603
c2_a_dw= exp(c1)
4
c2_a_dw = 1×6
2.4780 1.1465 0.4678 0.3838 0.7594 1.9354
d1_a_dw = 1×25
0 1.0000 1.0000 1.0000 -1.0000 -1.0000 -1.0000 1.0000
plot(t(1:length(d1)),0.5*d1_a_dw,'red')
hold on;
plot(t(1:length(d1)),d1,'blue')
hold off;
title("Amplitude Down Scaling")
xlabel("Time")
ylabel("Amplitude")
legend('Down Scaled','Orignal')
Time Scaling
Theory:
The time scaling of a continuous time signal x(t) can be accomplished by replacing ‘t’ by ‘�t’ in the function.
Mathematically, it is given by,
5
If α > 1, then the signal is compressed in time by a factor α and the time scaling
of the signal is called the time compression. Whereas, if α < 1, then the signal is
expanded in time by the factor α and the time scaling is said to be time expansion.
a1_t_ex = 1×2
0 1
b1_t_ex= square(b)
b1_t_ex = 1×11
1 1 -1 -1 -1 1 1 1 -1 -1 -1
c1_t_ex= cos(c)
c1_t_ex = 1×6
0.9074 0.1367 -0.7597 -0.9577 -0.2752 0.6603
6
c2_t_ex= exp(c1)
c2_t_ex = 1×6
2.4780 1.1465 0.4678 0.3838 0.7594 1.9354
d1_t_ex = 1×25
0 1.0000 1.0000 1.0000 -1.0000 -1.0000 -1.0000 1.0000
plot(2*t(1:length(d1_t_ex)),d1_t_ex,'red')
hold on;
plot(t(1:length(d1)),d1,'blue')
hold off;
title("Time Expansion")
xlabel("Time")
ylabel("Amplitude")
legend('Expanded','Orignal')
a1_t_co = 1×2
0 1
b1_t_co= square(b)
b1_t_co = 1×11
1 1 -1 -1 -1 1 1 1 -1 -1 -1
7
c1_t_co= cos(c)
c1_t_co = 1×6
0.9074 0.1367 -0.7597 -0.9577 -0.2752 0.6603
c2_t_co= exp(c1)
c2_t_co = 1×6
2.4780 1.1465 0.4678 0.3838 0.7594 1.9354
d1_t_co = 1×25
0 1.0000 1.0000 1.0000 -1.0000 -1.0000 -1.0000 1.0000
plot(0.5*t(1:length(d1_t_co)),d1_t_co,'red')
hold on;
plot(t(1:length(d1)),d1,'blue')
hold off;
title("Time Compression")
xlabel("Time")
ylabel("Amplitude")
legend('Compressed','Orignal')
Time Reversal/Folding
Theory:
The time reversal of a continuous time signal x(t) is the rotation of the signal by 180° about the vertical axis.
Mathematically, for the continuous time signal x(t), the time reversal is given as,
8
y(�) = �(−�)
An arbitrary continuous-time signal x(t) and its time reversal x(-t) are shown in Figure.
a1_t_co= a
a1_t_co = 1×2
0 1
b1_t_co= square(b)
b1_t_co = 1×11
1 1 -1 -1 -1 1 1 1 -1 -1 -1
c1_t_co= cos(c)
c1_t_co = 1×6
0.9074 0.1367 -0.7597 -0.9577 -0.2752 0.6603
c2_t_co= exp(c1)
c2_t_co = 1×6
2.4780 1.1465 0.4678 0.3838 0.7594 1.9354
d1_t_co = 1×25
0 1.0000 1.0000 1.0000 -1.0000 -1.0000 -1.0000 1.0000
plot(-t(1:length(d1_t_co)),d1_t_co,'red')
hold on;
plot(t(1:length(d1_t_co)),d1,'blue')
hold off;
title("Time Folding/Reversal")
xlabel("Time")
ylabel("Amplitude")
legend('Folded','Orignal')
9
Time Shifting
Theory:
The time-shifting of a signal results in the time delay or time advancement. The above expression shows that
the signal y(t) can be obtained by time shifting the signal x(t) by t0 units. If t0 is positive in the above expression,
then the shift of the signal is to the right and hence the time shifting delays the signal. On the other hand, if t0 is
negative, then the shift of the signal is to the left and hence the shifting advances the signal in the time axis.
10
Time Shifting (Delay)
a1_t_sd= a
a1_t_sd = 1×2
0 1
b1_t_sd= square(b)
b1_t_sd = 1×11
1 1 -1 -1 -1 1 1 1 -1 -1 -1
c1_t_sd= cos(c)
c1_t_sd = 1×6
0.9074 0.1367 -0.7597 -0.9577 -0.2752 0.6603
c2_t_sd= exp(c1)
c2_t_sd = 1×6
2.4780 1.1465 0.4678 0.3838 0.7594 1.9354
d1_t_sd = 1×25
0 1.0000 1.0000 1.0000 -1.0000 -1.0000 -1.0000 1.0000
plot(t(1:length(d1_t_sd))+5,d1_t_sd,'red')
hold on;
plot(t(1:length(d1_t_sd)),d1,'blue')
hold off;
title("Time Delaying")
xlabel("Time")
ylabel("Amplitude")
11
legend('Delayed','Orignal')
a1_t_sa = 1×2
0 1
b1_t_sa= square(b)
b1_t_sa = 1×11
1 1 -1 -1 -1 1 1 1 -1 -1 -1
c1_t_sa= cos(c)
c1_t_sa = 1×6
0.9074 0.1367 -0.7597 -0.9577 -0.2752 0.6603
c2_t_sa= exp(c1)
c2_t_sa = 1×6
2.4780 1.1465 0.4678 0.3838 0.7594 1.9354
d1_t_sa = 1×25
0 1.0000 1.0000 1.0000 -1.0000 -1.0000 -1.0000 1.0000
plot(t(1:length(d1_t_sa))-5,d1_t_sa,'red')
hold on;
plot(t(1:length(d1_t_sa)),d1,'blue')
12
title("Time Advancing")
xlabel("Time")
ylabel("Amplitude")
legend('Advanced','Orignal')
Part B
13
14
15
16
Conclusion
17