DSP_UE205015
DSP_UE205015
DSP_UE205015
THEORY:
• Development of algorithms.
• Modeling and simulation of systems.
Command Window
Workspace
Current Directory
Figure Window
Command Window: Whenever MATLAB is invoked, the main window called command
window is activated. The command window displays the command prompt’>>’ and a cursor
where commands are entered and are executed instantaneously.
Workspace: A workspace is a collection of all the variables that have been generated so far
in the current MATLAB session and shows their data type and size. All the commands
executed from Command Window and all the script files executed from the Command
Window share common workspace, so they can share all the variables.
Current Directory: The Current Directory window contains all the files and folders present in
the Current Directory. To run any file, it must either be in the Current Directory or on the
search path.
Edit Window: An Edit Window is used to create a new program file, or to modify existing
files. In this window, programs can be written, edited and saved. The programs written
using the MATLAB editor are automatically assigned an extension (.m) by the editor and are
known as M- files.
Figure Window: A Figure Window is a separate window with default white background and
is used to display MATLAB graphics. The results of all the graphic commands executed are
displayed in the figure window.
BASIC COMMANDS:
a)Unit step signal b)unit ramp signal c)Unit impulse signal d)Exponential signal
MATLAB provides a wide range of graph plotting application. The uses can plot 2D as well as
3D graphs. It also provides us the different color codes to highlight different segments of the
graph.
Stem(Y) plots the data sequence, Y, as stems that extend from a baseline along the x-axis.
The data values are indicated by circles terminating each stem:
Depending upon the value of a the discrete time real exponential signal may be of following
type –
When a < 1, the exponential sequence x(n) grows exponentially.
When 0 < a < 1, the exponential signal x(n) decays exponentially.
When a < 0, the exponential sequence x(n) takes alternating signs.
PROGRAM :
%% exponential signal
subplot(2,2,4);
x= -5:5;
y=exp(x);
stem(x,y);
xlabel ['time']
ylabel ['signal']
title ['exponential signal']
OBSERVATION :
The following figure justifies for the output of the program written above.
EXPERIMENT NO. 3
AIM: To generate advanced and delayed basic elementary signals in MATLAB.
THEORY:
MATLAB can be used to perform shifting of signals. A signal can be delayed as well as
advanced. Consider a discrete time signal x[n], then the time shifted version of the signal
x[n] represented as y[n] is defined as y[n] = x[n+n0]. Now, n0 can be negative or positive. If
n0 is negative, signal is shifted backwards and this is called “Time-Delayed Shifting”. If n0 is
positive, signal is shifted forward and this is called “Time- Advanced Shifting”.
Time-Delayed Signals: Suppose that we want to move this signal right by three units. Such a
signal can be mathematically written as y[n] = x[n-3]. This kind of signal is referred to as
time-delayed because we have made the signal arrive three units late .
Time-Advanced Signals: On the other hand, let's say that we want the same signal to arrive
early. Consider a case where we want our output signal to be advanced by, say, two units.
This objective can be accomplished by shifting the signal to the left by two time units, i.e.,
y[n] = x[n+2].
PROGRAMS:
subplot(2,2,1);
x= -5:5;
n= x-2;
y=[zeros(1,5) ones(1,6)];
stem(n,y);
xlabel ['time']
ylabel ['signal']
title ['advanced unit step signal']
subplot(2,2,2);
x = -5:5;
n=x-2;
y = [zeros(1,5) ones(1,6)];
f=n.*y;
stem(n,f);
xlabel ['time']
ylabel ['signal']
title ['advanced unit ramp signal']
subplot(2,2,3);
x= -5:5;
n=x-2;
y=[zeros(1,5) ones(1,1) zeros(1,5)];
stem(n,y);
xlabel ['time']
ylabel ['signal']
title ['advanced unit impulse signal']
subplot(2,2,4);
x= -5:5;
n=x-2;
y=exp(n);
stem(n,y);
xlabel ['time']
ylabel ['signal']
title ['advanced exponential signal']
subplot(2,2,1);
x= -5:5;
n= x+2;
y=[zeros(1,5) ones(1,6)];
stem(n,y);
xlabel ['time']
ylabel ['signal']
title [' delayed unit step signal']
subplot(2,2,2);
x = -5:5;
n=x+2;
y = [zeros(1,5) ones(1,6)];
f=n.*y;
stem(n,f);
xlabel ['time']
ylabel ['signal']
title [' delayed unit ramp signal']
subplot(2,2,3);
x= -5:5;
n=x+2;
y=[zeros(1,5) ones(1,1) zeros(1,5)];
stem(n,y);
xlabel ['time']
ylabel ['signal']
title [' delayed unit impulse signal']
subplot(2,2,4);
x= -5:5;
n=x+2;
y=exp(n);
stem(n,y);
xlabel ['time']
ylabel ['signal']
title ['delayed exponential signal']
OBSERVATION :
OBVSERVATION:
EXPERIMENT NO. 4
AIM: To study convolution technique of two signals.
It outputs the convolution of input vectors a and b, simply put as two signal functions.lnput
vectors, specified as either row or column vectors. The vectors a and b can be different
lengths or data types.
Program:
To determine the convoluted output of two arbitary signals, say x[n] and h[n] with output
signal as y[n]. We have the program written in following way in the text editor window of
MATLAB environment with all labels and subplots as defined below.
%% convolution of DT sequences