You are on page 1of 7

Lab 2: Addition and Multiplication of Signals along

with Time Scaling and Time Shifting

Task 1
Addition of two Signals
Plot the Graph of Addition of two waves

MATLAB Code:
t=0:0.001:0.1;
f=50;
t1=6.2*f*t;
x1=sin(t1);
subplot(3,1,1);
plot(t,x1,’r’);
title(’Sine Wave’)
legend(’M. Naveed’);
x2=cos(t1);
subplot(3,1,2);
plot(t,x2,’k’);
title(’Cosine Wave’)
legend(’M. Naveed’);
y=x1+x2;
subplot(3,1,3);
plot(t,y,’b’);
title(’Addition of two Signals’);
legend(’M. Naveed’);
Graph:

Sine Wave
1
M. Naveed

-1
0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1
Cosine Wave
1
M. Naveed

-1
0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1
Addition of two Signals
2
M. Naveed

-2
0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1

0.1 results:
Hence, we have obtained the desired graph of Additive waveform.

Task 2
Multiplication of two signala
Plot graph of Multiplication of two waves.

MATLAB Code:
t=0:0.001:0.1;
f=50;
t1=6.2*f*t;
x1=sin(t1);
subplot(3,1,1);
plot(t,x1,’b’);
title(’Sine Wave’);
xlabel(’t’);
ylabel(’x1’);
legend(’M. Naveed’);
x2=cos(t1);
subplot(3,1,2);
plot(t,x2,’r’);
title(’Cosine Wave’);
xlabel(’t’);
ylabel(’x2’);
legend(’M. Naveed’);
y=(x1’*x2);
subplot(3,1,3);
plot(t,y,’g’);
title(’Multiplication of two Signals’);
xlabel(’t’);
ylabel(’y’);
legend(’M. Naveed’);

Graph:

Sine Wave
1
M. Naveed
x1

-1
0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1
t
Cosine Wave
1
M. Naveed
x2

-1
0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1
t
Multiplication of two Signals
1
M. Naveed

0
y

-1
0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1
t

result:
Hence, we have obtained the graph of Multiplication of two waveforms .

Task 3
Time Scaling of Signals
Plot the graph which shows time scaling of signal.
MATLAB Code:
t=-3:4;
x=[1 2 3 5 8 7 4 2];
figure
subplot(3,1,1)
plot(t,x,’g’)
xlim([-10 10])
title(’Orignal Signal’)
xlabel(’Amplitude’)
ylabel(’Amplitude’)
xlabel(’Samples’)
legend(’M. Naveed’)
grid on
subplot(3,1,2)
plot(2*t,x,’r’)
xlim([-10 10])
xlabel(’Samples’)
ylabel(’Amplitude’)
title(’Expended Signal’)
grid on
subplot(3,1,3)
plot(t/2,x,’m’)
xlim([-10 10])
xlabel(’Samples’)
ylabel(’Amplitude’)
title(’Compressed Signal’) grid on legend(’M. Naveed’)
Graph:

Orignal Signal
Amplitude

M. Naveed
5

0
-10 -8 -6 -4 -2 0 2 4 6 8 10
Samples
Expended Signal
Amplitude

0
-10 -8 -6 -4 -2 0 2 4 6 8 10
Samples
Compressed Signal
Amplitude

M. Naveed
5

0
-10 -8 -6 -4 -2 0 2 4 6 8 10
Samples

result
Hence, we have obtained the compressed and expended signal.

1 Analysis
After this, we can analysis that time scaling included compression and ex-
pension .

Task 4
Time Shifting of Signal
Plot the graph which shows time shifting of signal.
Pseudo Code
t=1:1.5:20;
x=5*sin(t);
subplot(3,1,1)
stem(t,x,’m’)
xlabel(’Time Period’)
ylabel(’Amplitude’)
title(’Orignal Signal’)
legend(’M. Naveed’)
subplot(3,1,2)
stem(t-5,x,’b’)
xlabel(’Time Period’)
ylabel(’Amplitude’)
title(’Signal Shifted left’)
legend(’M. Naveed’)
subplot(3,1,3)
stem(t+5,x,’y’)
xlabel(’Time Period’)
ylabel(’Amplitude’)
title(’Signal Shifted Right’)
legend(’M. Naveed’)
Graph:

Orignal Signal
5
Amplitude M. Naveed

-5
0 2 4 6 8 10 12 14 16 18 20
Time Period
Signal Shifted left
5
Amplitude

M. Naveed

-5
-4 -2 0 2 4 6 8 10 12 14
Time Period
Signal Shifted Right
5
Amplitude

M. Naveed

-5
6 8 10 12 14 16 18 20 22 24
Time Period

result
Hence, we have obtained left shifted and right shifted signals .

Analysis:
After this, we can analysis that time shifting is refered to shifting signal
either right or left.

Conclusion:
In this lab experiment we have deduced about the addition and multiplica-
tion of signals. Moreover, we also understand the concept of time scaling of
signals and time shifting of signals.

You might also like