Sunteți pe pagina 1din 7

EXPERIMENT 2

AIM: To develop a program for manipulation of discrete time signals.

APPARATUS: Matlab version 7.7.1, laptop.

THEORY:
A signal is defined as any physical quantity that varies with time, space or any other
independent variable or variables.

Properties of signals:

1. Addition

If two signals x1(n) and x2(n) are added the resulted signal y(n) is:

Fig 1.1.1 x1(n) Fig 1.1.2 x2(n) Fig 1.1.3 y(n)

2. Subtraction

If two signals x1(n) and x2(n) are subtracted the resulted signal y(n) is:

Fig 1.2.1 x1(n) Fig 1.2.2 x2(n) Fig 1.2.3 y(n)


3. Multiplication

If two signals x1(n) and x2(n) are multiplicaed the resulted signal y(n) is:

Fig 1.3.1 x1(n) Fig 1.3.2 x2(n) Fig 1.3.3 y(n)

4. Division

If two signals x1(n) and x2(n) are divided the resulted signal y(n) is:

Fig 1.4.1 x1(n) Fig 1.4.2 x2(n) Fig 1.4.3 y(n)

5. Amplitude scaling

Consider a signal x(n) which is multiplying by a constant 'A' and this can be indicated by a
notation x(n) Ax(n). For any arbitraryt this multiplies the signal value x(n) by a
constant 'A'. Thus, x(n) Ax(n) multiplies x(n) at every value of 'n' by a constant 'A'. This is
called amplitude-scaling. If the amplitude-scaling factor is negative then it flips the signal
with the t-axis as the rotation axis of the flip. If the scaling factor is -1 then only the signal
will be flip. This is shown in the Figure 3(a), 3(b), 3(c) which is given below.

Fig.1.5.1 A signal x(n) Fig. 1.5.2 x(t) scaled by -1 Fig. 1.5.3 x(t) scaled by
6. Folding

Folding is done by shifting the signal about origin. Consider a signal x(n). Then its folded
version will be:
y(n)=x(-n)

Fig. 1.6.1 Signal x(n) Fig. 1.6.2 Signal x(-n)

7. Folding with delay

Firstly, signal is folded and then shifting is done. Consider a signal x(n):

Fig. 1.7.1 Signal x(n) Fig. 1.7.2 Signal x(-n)

Fig. 1.7.3 Signal x(-n+2)

8. Time Scaling

Time scaling compresses or dilates a signal by multiplying the time variable by some
quantity. If that quantity is greater than one, the signal becomes narrower and the operation is
called compression. If that quantity is less than one, the signal becomes wider and the
operation is called dilation. Figure 1.8.1, 1.8.2, 1.8.3 shows the signal x(n), compression of
signal and dilation of signal respectively.
Fig.1.8.1 Signal x(n) Fig.1.8.2 Compression of signal Fig.1.8.3 Dilation of signal

9. Time shifting

If a discrete time signal is defined as x(n) = s(n - n1). Then we can say that x(n) is the time
shifted version of s(n).
Consider a simple signal x(n):

Fig.1.9.1 Signal x(n)

Now shifting the function by time n1 = 3 sec.


Then sequence is shifted towards right which is simply signal x(n) with its origin delayed by
3 sec.

Fig.1.9.2 x(n) shifted by 3 sec. [x(n-3)]

Now if we shift the signal by n1 = -2 sec.


Then sequence is shifted towards left which is simply signal x(n) with its origin advanced by
2 sec.

Fig.1.9.3 x(n) shifted by -2 sec. [x(n+2)]


10. Delay

If a sequence x(n) is shifted by some n value then it is said to be delayed by n.

Fig. 1.10.1 x(n) Fig. 1.10.2 x(n-(-4))

11. Advance

If a sequence x(n) is shifted by some n value then it is said to be advanced by n.

Fig. 1.11.1 x(n) Fig. 1.11.2 x(n-4)

MATLAB CODE:
clc; //clears the command window
clear all; //clears all the windows
close all; //close all windows
t=0:4;
x1=[1 2 3 4 5];
subplot(4,4,1);
stem(t,x1)
title('sequence(*1)');
xlabel('time');
ylabel('amplitude');

subplot(4,4,2);
stem(2*t,x1)
title('sequence(*2)');
xlabel('time');
ylabel('amplitude');

x2=[4 8 5 2 3];
y=x1+x2;
subplot(4,4,3);
stem(t,y);
title('addition');
xlabel('time');
ylabel('amplitude');

y=x1-x2;
subplot(4,4,4);
stem(t,y);
title('subtraction');
xlabel('time');
ylabel('amplitude');

y=x1.*x2;
subplot(4,4,5);
stem(t,y)
title('multiplication');
xlabel('time');
ylabel('amplitude');

y=x1./x2;
subplot(4,4,6);
stem(t,y);
title('division');
xlabel('time');
ylabel('amplitude');

y=2*x1;
subplot(4,4,7);
stem(t,y);
title('Amplitude up scaling');
xlabel('time');
ylabel('amplitude');

y=x1/2;
subplot(4,4,8)
stem(t,y);
title('amplitude down scaling');
xlabel('time');
ylabel('amplitude');

subplot(4,4,9);
stem(-t,x1);
title('folding');
xlabel('time');
ylabel('amplitude')

subplot(4,4,10);
stem(-t+2,x1);
title('folding with delay');
xlabel('time');
ylabel('amplitude');
subplot(4,4,11);
stem(-t-2,x1);
title('folding and advance');
xlabel('time');
ylabel('amplitude');

subplot(4,4,12);
stem(2*t,x1);
title('time scaling');
xlabel('time');
ylabel('amplitude');

subplot(4,4,13);
stem(t-3,x1);
title('Advance');
xlabel('time');
ylabel('amplitude');

subplot(4,4,14);
stem(t+6,x1);
title('Delay');
xlabel('time');
ylabel('amplitude');

OUTPUT WINDOW:

S-ar putea să vă placă și