Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

EXPERIMENT -2:

AIM:
To perform basic operations like addition , subtraction , multiplication and division
on signals using MATLAB .

THEORY:
Addition:
Addition of two signals is nothing but addition of their corresponding
amplitudes. This can be best explained by using the following example:

As seen from the diagram above,


-10 < t < -3 amplitude of z(t) = x1(t) + x2(t) = 0 + 2 = 2
-3 < t < 3 amplitude of z(t) = x1(t) + x2(t) = 1 + 2 = 3
3 < t < 10 amplitude of z(t) = x1(t) + x2(t) = 0 + 2 = 2
Subtraction:
Subtraction of two signals is nothing but subtraction of their corresponding
amplitudes. This can be best explained by the following example:

As seen from the diagram above,


-10 < t < -3 amplitude of z (t) = x1(t) - x2(t) = 0 - 2 = -2
-3 < t < 3 amplitude of z (t) = x1(t) - x2(t) = 1 - 2 = -1
3 < t < 10 amplitude of z (t) = x1(t) + x2(t) = 0 - 2 = -2

Multiplication:
Multiplication of two signals is nothing but multiplication of their
corresponding amplitudes. This can be best explained by the following
As seen from the diagram above,
-10 < t < -3 amplitude of z (t) = x1(t) ×x2(t) = 0 ×2 = 0
-3 < t < 3 amplitude of z (t) = x1(t) ×x2(t) = 1 ×2 = 2
3 < t < 10 amplitude of z (t) = x1(t) × x2(t) = 0 × 2 = 0

CODE:
t=0:0.01:2*pi;
subplot(3,2,1)
plot(t,sin(t)) %to plot sine wave signal%
xlabel("X--->")
ylabel("Y--->")
title("Sine Waveform")
subplot(3,2,2)
plot(t,cos(t)) %to plot cosine wave signal%
xlabel("X--->")
ylabel("Y--->")
title("Cosine waveform")
subplot(3,2,3)
plot(t,sin(t)+cos(t)) %to plot sum of signal%
xlabel("X--->")
ylabel("Y--->")
title("Addition Operation")
subplot(3,2,4)
plot(t,sin(t)-cos(t)) %to plot difference signal%
xlabel("X--->")
ylabel("Y--->")
title("Subtraction Operation")
subplot(3,2,5)
plot(t,sin(t).*cos(t)) %to plot multiplication signal%
xlabel("X--->")
ylabel("Y--->")
title("Multiplication Operation")
subplot(3,2,6)
plot(t,sin(t).\cos(t)) %to plot division signal%
xlabel("X--->")
ylabel("Y--->")
title("Division Operation")
RESULT:
The necessary plots of addition , subtraction , multiplication , division have been
plotted.

You might also like