### MATLAB Program For Time Delaying And Time Advancement Operations On Signals

A signal is a physical quantity that varies with time, space or any other independent variable by which information can be conveyed. A discrete-time signal is often identified as a sequence of numbers, denoted by x[n], where n is an integer. Signals are broadly classified into continuous and discrete signals. A continuous signal will be denoted by x(t), in which the variable t can represent any physical quantity. A discrete signal will be denoted by x[n], in which the variable n is integer value. The variables t and n are assumed to represent time.

Operations on Signals:

a. Time Shifting

In this operation each sample of x(n) is shifted by an amount k to obtain a shifted sequence y(n)

Y(n) = {x(n-k)}

If we let m=n-k, then n=m+k and the above operation is given by

Y(m+k) = {x(m)}

b.Time Delay: The system has a general form of y[n]= x[n - b], where ‘b’ is any positive integer. Letus take an example where b=2 and analyze the scenario. The output signal is y[n] = x[n-2]. This means that what has happened to the input signal x two time units back happens now for output signal ‘y’.

c.Time Advance: The system has a general form of y[n]= x[n + b], where ‘b’ is any positive integer. When b = 2 the output signal becomes y[n] = x[n+2]. This means that what will happen to the input signal ‘x’ two time units in future happens now for output signal ‘y’.

Program:

clc;

close all;

clear all

%Generate
the first sequence

L1=input('Enter input for lower value=');

H1=input('Enter input for higher value=');

n1=L1:H1

x=input('Enter a first sequence=')

subplot(4,1,1);

stem(n1,x);

title('X');

axis tight;

grid on;

%Time
shifting operation

subplot(4,1,2);

stem(n1,x);

title('Original
Signal,x(n)');

axis tight;

grid on;

%Delayed
version of x(n)

Delay =
input('Enter the amount to be delayed= ');

m=n1+Delay;

x1=x;

disp(m)

disp(x1)

subplot(4,1,3);

stem(m,x1);

title('Delayed Signal x(n)');

grid on;

%Advanced
version of x(n)

Advance =
input('Enter the amount to be Advanced= ');

t=n1-Advance;

x2=x;

disp(t)

disp(x2)

subplot(4,1,4);

stem(t,x2);

title('Advanced Signal x(n)');

grid on;