Lab 4
Lab 4
Objective
In this lab we will be able to:
To implement different operation on signal and sequence like addition,
multiplication, scaling, shifting, and folding.
To extract even and odd part of the signals.
Introduction
In this report, we will discuss various operations that can be performed on signals and
sequences in MATLAB, such as addition, multiplication, scaling, shifting, folding, and
extraction of even and odd parts of signals.
Procedure
The following are the set of instructions that are needed to be followed:
Addition
Signals can be added together by simply using the "+" operator in MATLAB. For
example, if "x" and "y" are two signals, their sum can be obtained by using the
command "z = x + y". This operation is known as superposition of signals, and it is
commutative and associative.
Multiplication
Signals can be multiplied together by using the "." operator in MATLAB. title (ample, if
"x" and "y" are two signals, their product can be obtained by using the command "z = x .
y". This operation is known as pointwise multiplication, and it is commutative but not
associative.
Scaling
Signals can be scaled by a constant value by using the "" operator in MATLAB. For
example, if "x" is a signal and "a" is a constant value, the scaled signal can be obtained
by using the command "y = ax". This operation is known as scaling, and it is
commutative and associative.
Shifting
Signals can be shifted in time by using the "circshift" function in MATLAB. For example,
if "x" is a signal and "n" is the number of samples to shift, the shifted signal can be
obtained by using the command "y = circshift(x, n)". This operation is known as time
shifting and it is not commutative and associative.
Folding
The "fliplr" function in MATLAB can be used to fold a signal about its midpoint. For
example, if "x" is a signal, its folded version can be obtained by using the command "y =
fliplr(x)". This operation is known as folding, and it is commutative and associative.
The "even" and "odd" functions in MATLAB can be used to extract the even and odd
parts of a signal, respectively. For example, if "x" is a signal, it’s even part can be
obtained by using the command "y = even(x)" and its odd part can be obtained by using
the command "y = odd(x)". This operation is known as even-odd decomposition, and it
is not commutative and associative.
Lab Task
t=0:.01:1;
x1=sin(2*pi*4*t);
x2=sin(2*pi*8*t);
subplot(2,2,1);
plot(t,x1);
xlabel('time');
ylabel('amplitude');
title('signal1:sine wave of frequency 4Hz');
subplot(2,2,2);
plot(t,x2);
xlabel('time');
ylabel('amplitude');
title('signal2:sine wave of frequency 8Hz');
l2=length(s1);
nx1=0:l2-1;
figure;
subplot(2,1,1);
stem(nx1,s1);
xlabel('nx1');
ylabel('amplitude');
title('input sequence1');
s6=fliplr(s1);
nf2=-fliplr(nx1);
subplot(2,1,2);
stem(nf2,s6);
xlabel('nf2');
Conclusion
In this report, we have discussed various operations that can be performed on signals
and sequences in MATLAB. These operations include addition, multiplication, scaling,
shifting, folding and extraction of even and odd parts of signals. It is important to note
that these operations are element-wise operation, the same index element of both
signals will be added/multiplied/scaled and so on. And it is also important to note that
the above operations are for discrete-time signals, for continuous-time signals this
operation are different.