Signal and System Lab Manual Deepak
Signal and System Lab Manual Deepak
(REGULATION 2018)
AS PER R.G.P.V UNIVERSITY SYLLABUS
1
IES College of Technology, Bhopal Signal and System
Semester ……………………………..
(EC-4002)
Name:
Roll Number:
Batch:
Department:
Year/Semester:
2
IES College of Technology, Bhopal Signal and System
SYLLABUS
IES College of Technology, Bhopal
Department of Electronics & Communication Engineering
BE – 4th Semester Session – 2017 – 18
1. Introduction to MATLAB
3
IES College of Technology, Bhopal Signal and System
Learning Outcomes:
The student will be:
1. Understand Basics of MATLAB syntax, functions and programming.
2. Analyze the generation Various Signals and Sequences in MATLAB, including the
operations on Signals and Sequences.
3. Determine the Convolution and Correlation between Signals and sequences.
4. Verification of Linearity and Time Invariance Properties of a given Continuous/Discrete
System.
5. Analyze the Fourier Transform of a given signal and plotting its magnitude and phase
spectrum.
4
IES College of Technology, Bhopal Signal and System
Experiment No 1
Objective: - Study of Introduction to MATLAB.
Introduction
MATLAB is widely used in all areas of applied mathematics, in education and research at
universities, and in the industry. MATLAB stands for MATrix LABoratory and the software
is built up around vectors and matrices. This makes the software particularly useful for linear
algebra but MATLAB is also a great tool for solving algebraic and differential equations and
for numerical integration. MATLAB has powerful graphic tools and can produce nice pictures
in both 2D and 3D. It is also a programming language, and is one of the easiest programming
languages for writing mathematical programs. MATLAB also has some tool boxes useful for
signal processing, image processing, optimization, etc.
PC: Choose the submenu "Programs" from the "Start" menu. From the "Programs" menu,
open the "MATLAB" submenu. From the "MATLAB" submenu, choose "MATLAB".
Unix: At the prompt, type matlab.
You can quit MATLAB by typing exit in the command window.
The MATLAB environment
Note: From now on an instruction to press a certain key will be denoted by < >, e.g., pressing
the enter key will be denoted as <enter>. Commands that should be typed at the prompt, will
be written in courier font.
The MATLAB environment (on most computer systems) consists of menus, buttons and a
writing area similar to an ordinary word processor. There are plenty of help functions that you
are encouraged to use. The writing area that you will see when you start MATLAB, is called
the command window. In this window you give the commands to MATLAB. For example,
when you want to run a program you have written for MATLAB you start the program in the
command window by typing its name at the prompt. The command window is also useful if
you just want to use MATLAB as a scientific calculator or as a graphing tool. If you write
longer programs, you will find it more convenient to write the program code in a separate
window, and then run it in the command window (discussed in Intro to programming).
In the command window you will see a prompt that looks like >> . You type your commands
immediately after this prompt. Once you have typed the command you wish MATLAB to
perform, press <enter>. If you want to interupt a command that MATLAB is running, type
<ctrl> + <c>.
The commands you type in the command window are stored by MATLAB and can be viewed
in the Command History window. To repeat a command you have already used, you can
simply double-click on the command in the history window, or use the <up arrow> at the
5
IES College of Technology, Bhopal Signal and System
command prompt to iterate through the commands you have used until you reach the
command you desire to repeat.
Useful functions and operations in MATLAB
Using MATLAB as a calculator is easy.
Example: Compute 5 sin(2.53-pi)+1/75. In MATLAB this is done by simply typing
5*sin(2.5^(3-pi))+1/75
at the prompt. Be careful with parantheses and don't forget to type * whenever you multiply!
Note that MATLAB is case sensitive. This means that MATLAB knows a difference between
letters written as lower and upper case letters. For example, MATLAB will understand sin(2)
but will not understand Sin(2).
Here is a table of useful operations, functions and constants in MATLAB.
MATLAB
Operation, function or constant
command
+ (addition) +
- (subtraction) -
� (multiplication) *
/ (division) /
ex exp(x)
sin x sin(x)
cos x cos(x)
tan x tan(x)
cot x cot(x)
arcsin x asin(x)
arccos x acos(x)
arctan x atan(x)
arccot x acot(x)
n! (n factorial) gamma(n+1)
e (2.71828...) exp(1)
(3.14159265...) pi
6
IES College of Technology, Bhopal Signal and System
Starting MATLAB
After logging into your account, you can enter MATLAB by double-clicking on the
MATLAB shortcut icon (MATLAB 7.0.4) on your Windows desktop. When you start
MATLAB, a special window called the MATLAB desktop appears. The desktop is a window
that contains other windows. The major tools within or accessible from the desktop are:
• The Command Window
• The Command History
• The Workspace
• The Current Directory
• The Help Browser
• The Start button
7
IES College of Technology, Bhopal Signal and System
MATLAB Windows:
MATLAB works with through these basic windows
Command Window
This is the main window .it is characterized by MATLAB command prompt
>> when you launch the application program MATLAB puts you in this window all
commands including those for user-written programs ,are typed in this window at the
MATLAB prompt
The Current Directory Window
The Current Directory window displays a current directory with a listing of its contents. There
is navigation capability for resetting the current directory to any directory among those set in
the path. This window is useful for finding the location of particular files and scripts so that
they can be edited, moved, renamed, deleted, etc. The default current directory is the Work
subdirectory of the original MATLAB installation directory
Graphics Window
The output of all graphics commands typed in the command window are flushed to the
graphics or figure window, a separate gray window with white background color the user can
create as many windows as the system memory will allow.
Edit Window
This is where you write edit, create and save your own programs in files called M files.
Input-output
MATLAB supports interactive computation taking the input from the screen and flushing, the
output to the screen. In addition it can read input files and write output files
Data Type
The fundamental data-type in MATLAB is the array. It encompasses several distinct data
objects- integers, real numbers, matrices, character strings, structures and cells. There is no
need to declare variables as real or complex, MATLAB automatically sets the variable to be
real.
8
IES College of Technology, Bhopal Signal and System
Dimensioning
Dimensioning is automatic in MAT LAB. No dimension statements are required for vectors
or arrays .we can find the dimensions of an existing matrix or a vector with the size and length
commands.
Where to work in MATLAB?
All programs and commands can be entered either in the
a) Command window
b) As an M file using MATLAB editor
Note: Save all M files in the folder 'work' in the current directory. Otherwise
you have to locate the file during compiling.
Typing quit in the command prompt>> quit, will close MATLAB Development
Environment.
For any clarification regarding plot etc, which are built in functions type help topic i.e.
help plot
Subplot (3 1 2) divides the figure window into 3 rows and 1 column 2 represent number of the
figure
9
IES College of Technology, Bhopal Signal and System
*************************
10
IES College of Technology, Bhopal Signal and System
Experiment No 2
Theory: If the amplitude of the signal is defined at every instant of time then it
is called continuous signal. If the amplitude of the signal is defined at only at
some instants of time then it is called discrete signal.
If the signal repeats itself at regular intervals then it is called periodic signal.
Otherwise they are called aperiodic signals.
EX: ramp,Impulse,unit step, sinc- Aperiodic signals square,sawtooth,triangular
sinusoidal – periodic signals.
Ramp sinal:
r(t)= t when t>=0
Sinc signal:
G(x)=(sinx)/x
11
IES College of Technology, Bhopal Signal and System
Program:
%generation of ramp signal
clc;
clear all;
close all;
fs=500;
t=0:1/fs:0.1;
y1=t;
subplot(2,2,1);
plot(t,y1);
xlabel('time');
ylabel('amplitude');
title('ramp signal');
%generation of ramp sequence
subplot(2,2,2);
stem(y1);
xlabel('n');
ylabel('amplitude');
title('ramp sequence');
%generation of impulse signal
y2=(t==0);
subplot(2,2,3);
plot(t,y2);
axis([-1 1 0 1])
xlabel('time');
ylabel('amplitude');
title('impulse signal');
%generation of impulse sequence
subplot(2,2,4);
stem(y2);
xlabel('n');
ylabel('amplitude');
title('impulse sequence');
%generation of unit step signal
n=-10:1:10;
y3=(n>=0);
figure;
subplot(2,2,1);
plot(n,y3);
xlabel('time');
ylabel('amplitude');
title('unit step signal');
%generation of unit step sequence
subplot(2,2,2);
12
IES College of Technology, Bhopal Signal and System
stem(n,y3);
xlabel('n');
ylabel('amplitude');
title('unit step sequence');
%generation of square wave signal
y4=square(2*pi*50*t);
subplot(2,2,3);
plot(t,y4);
axis([0 0.1 -2 2]);
xlabel('time');
ylabel('amplitude');
title('square wave signal');
%generation of square wave sequence
subplot(2,2,4);
stem(y4);
xlabel('n');
ylabel('amplitude');
title('square wave sequence');
%generation of sawtooth signal
y5=sawtooth(2*pi*50*t);
figure;
subplot(2,2,1);
plot(t,y5);
axis([0 0.1 -2 2]);
xlabel('time');
ylabel('amplitude');
title('sawtooth wave signal');
%generation of sawtooth sequence
subplot(2,2,2);
stem(y5);
xlabel('n');
ylabel('amplitude');
title('sawtooth wave sequence');
%generation of triangular wave signal
y6=sawtooth(2*pi*50*t,.5);
subplot(2,2,3);
plot(t,y6);
axis([0 0.1 -2 2]);
xlabel('time');
ylabel('amplitude');
title(' triangular wave signal');
%generation of triangular wave sequence
subplot(2,2,4);
stem(y6);
xlabel('n');
ylabel('amplitude');
title('triangular wave sequence');
13
IES College of Technology, Bhopal Signal and System
14
IES College of Technology, Bhopal Signal and System
15
IES College of Technology, Bhopal Signal and System
******************************
16
IES College of Technology, Bhopal Signal and System
Experiment No 3
Objective:- To explore the commutation of even and odd symmetries in a signal with
algebraic operations.
Apparatus Required:- Computer with MATLAB software
Theory: Even and odd signals bear some important symmetry properties. Under reversal of
independent variable, these signals either remain the same (even signal) or get reflected or
flipped (odd signal) about the horizontal axis.
Equations or definitions (1) and (2) mathematically express these properties for both
continuous and discrete time cases.
Even Signals: x(t) = x(–t), x[n] = x[–n] (1)
Odd Signals: x(t) = –x(–t), x[n] = –x[–n] (2)
Program:
clear;
clc;
close;
t=0:5;
x=[ 0 2 4 2 0 0];
figure
a=gca();
plot2d3(t,x)
plot(t,x,'r.')
xtitle('x[n]','n')
a.thickness=2;
figure
a=gca();
t2=-5:5 ;
y=[ x($:-1:2)./2 x(1) x(2:6)./2 ]
plot2d3(t2,y)
plot(t2,y,'r.')
xtitle('even','n')
a.y_location='right';
a.thickness=2;
17
IES College of Technology, Bhopal Signal and System
figure
a=gca();
z=[ -x($:-1:2)./2 0 x(2:6)./2 ]
plot2d3(t2,z)
plot(t2,z,'r.')
xtitle('odd','n')
a.y_location='right';
a.x_location='origin';
a.thickness=2;
******************************
18
IES College of Technology, Bhopal Signal and System
Experiment No 4
Objective:- To explore the effect of transformation of signal parameters (amplitude-scaling,
time scaling and time-shifting).
Theory:
Signal Addition
Addition: any two signals can be added to form a third signal,
z (n) = x (n) + y (n)
Multiplication:
Multiplication of two signals can be obtained by multiplying their values at every instants .
z (n) = x (n) y (n)
Time reversal/Folding:
Time reversal of a signal x(t) can be obtained by folding the signal about
n=0. Y(n)=y(-n)
Signal Amplification/Scaling : Y(n)=ax(n) if a < 1 attnuation a >1 amplification
Time shifting: The time shifting of x(n) obtained by delay or advance the signal in time by
using y(n)=x(n+k)
19
IES College of Technology, Bhopal Signal and System
If k is a positive number, y(n) shifted to the right i e the shifting delays the signal
If k is a negative number, y(n ) it gets shifted left. Signal Shifting advances the signal.
Program:
clc;
clear all;
close all;
t=0:.01:1;
% generating two input signals
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');
% addition of signals
y1=x1+x2;
subplot(2,2,3);
plot(t,y1);
xlabel('time');
ylabel('amplitude');
title('resultant signal:signal1+signal2');
% multiplication of signals
y2=x1.*x2;
subplot(2,2,4);
plot(t,y2);
20
IES College of Technology, Bhopal Signal and System
xlabel('time');
ylabel('amplitude');
title('resultant signal:dot product of signal1 and signal2');
% scaling of a signal1
A=10;
y3=A*x1;
figure;
subplot(2,2,1);
plot(t,x1);
xlabel('time');
ylabel('amplitude');
title('sine wave of frequency 4Hz')
subplot(2,2,2);
plot(t,y3);
xlabel('time');
ylabel('amplitude');
title('amplified input signal1 ');
% folding of a signal1
l1=length(x1);
nx=0:l1-1;
subplot(2,2,3);
plot(nx,x1);
xlabel('nx');
ylabel('amplitude');
title('sine wave of frequency 4Hz')
y4=fliplr(x1);
nf=-fliplr(nx);
subplot(2,2,4);
plot(nf,y4);
xlabel('nf');
ylabel('amplitude');
title('folded signal');
%shifting of a signal
figure;
21
IES College of Technology, Bhopal Signal and System
t1=0:.01:pi;
x3=8*sin(2*pi*2*t1);
subplot(3,1,1);
plot(t1,x3);
xlabel('time t1');
ylabel('amplitude');
title('sine wave of frequency 2Hz');
subplot(3,1,2);
plot(t1+10,x3);
xlabel('t1+10');
ylabel('amplitude');
title('right shifted signal');
subplot(3,1,3);
plot(t1-10,x3);
xlabel('t1-10');
ylabel('amplitude');
title('left shifted signal');
%operations on sequences
n1=1:1:9;
s1=[1 2 3 0 5 8 0 2 4];
figure;
subplot(2,2,1);
stem(n1,s1);
xlabel('n1');
ylabel('amplitude');
title('input sequence1');
n2=-2:1:6;
s2=[1 1 2 4 6 0 5 3 6];
subplot(2,2,2);
stem(n2,s2);
xlabel('n2');
ylabel('amplitude');
title('input sequence2');
% addition of sequences
22
IES College of Technology, Bhopal Signal and System
s3=s1+s2;
subplot(2,2,3);
stem(n1,s3);
xlabel('n1');
ylabel('amplitude');
title('sum of two sequences');
% multiplication of sequences
s4=s1.*s2;
subplot(2,2,4);
stem(n1,s4);
xlabel('n1');
ylabel('amplitude');
title('product of two sequences');
% scaling of a sequence
figure;
subplot(2,2,1);
stem(n1,s1);
xlabel('n1');
ylabel('amplitude');
title('input sequence1');
s5=4*s1;
subplot(2,2,2);
stem(n1,s5);
xlabel('n1');
ylabel('amplitude');
title('scaled sequence1');
% shifting of a sequence
subplot(2,2,3);
stem(n1-2,s1);
xlabel('n1');
ylabel('amplitude');
title('left shifted sequence1');
subplot(2,2,4);
stem(n1+2,s1);
23
IES College of Technology, Bhopal Signal and System
xlabel('n1');
ylabel('amplitude');
title('right shifted sequence1');
% folding of a sequence
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');
ylabel('amplitude');
title('folded sequence1');
24
IES College of Technology, Bhopal Signal and System
******************************
25
IES College of Technology, Bhopal Signal and System
Experiment No 5
Objective:- To explore the time variance and time invariance property of a given system.
Required: Computer with MATLAB software
Theory:
TIME INVARIENT SYSTEMS (TI):
A system is called time invariant if its input – output characteristics do not change with time
X(t)---- input : Y(t) ---output
X(t-T) -----delay input by T seconds : Y(t-T) ------ Delayed output by T seconds
Program:
clc;
clear all;
close all;
% entering two input sequences
x = input( ' Type the samples of signal x(n) ' );
h = input( ' Type the samples of signal h(n) ' );
% original response
y = conv(x,h);
disp( ' Enter a POSITIVE number for delay ' );
d = input( ' Desired delay of the signal is ' );
% delayed input
xd = [zeros(1,d), x];
nxd = 0 : length(xd)-1;
%delayed output
yd = conv(xd,h);
nyd = 0:length(yd)-1;
disp(' Original Input Signal x(n) is ');
disp(x);
disp(' Delayed Input Signal xd(n) is ');
disp(xd);
disp(' Original Output Signal y(n) is ');
disp(y);
26
IES College of Technology, Bhopal Signal and System
27
IES College of Technology, Bhopal Signal and System
******************************
28
IES College of Technology, Bhopal Signal and System
Experiment No 6
Objective:- To explore causality and non-causality property of a system.
Apparatus Required:- Computer with MATLAB software
Theory:
A) Causal systems:
Definition:
A system is said to be causal system if its output depends on present and past
inputs only and not on future inputs.
Examples:
The output of casual system depends on present and past inputs, it means y(n) is
a function of x(n), x(n-1), x(n-2), x(n-3)…etc. Some examples of causal systems
are given below:
1) y(n) = x(n) + x(n-2)
2) y(n) = x(n-1) – x(n-3)
3) y(n) = 7x(n-5)
B) Non-causal system:
Definition:
A system whose present response depends on future values of the inputs is
called as a non-causal system.
Examples:
In this case, output y(n) is function of x(n), x(n-1), x(n-2)…etc. as well as it is
function of x(n+1), x(n+2), x(n+3), … etc. following are some examples of non-
causal systems:
1) Y(n) = x(n) + x(n+1)
2) Y(n) = 7x(n+2)
3) Y(n) = x(n) + 9x(n+5)
29
IES College of Technology, Bhopal Signal and System
Program (a)
clc;
disp(' y[n]=3x[n-2]+3x[n+2] ');
disp('THE GIVEN SYSTEM IS NON-CAUSAL');
disp('Since the value of output depends on future input');
Result:
y[n]=3x[n-2]+3x[n+2]
THE GIVEN SYSTEM IS NON-CAUSAL
Since the value of output depends on future input
Program (b)
clc;
disp(' y[n]=x[n-1]+a*x[n-2] ');
disp('THE GIVEN SYSTEM IS CAUSAL');
disp('Since the value of output doesnot depends on future input');
Result:
y[n]=x[n-1]+a*x[n-2]
THE GIVEN SYSTEM IS CAUSAL
Since the value of output does not depends on future input
******************************
30
IES College of Technology, Bhopal Signal and System
Experiment No 7
Objective:- To demonstrate the convolution and correlation of two continuous-time signals.
7(a) Aim:- To demonstrate the convolution of two continuous-time signals.
If a continuous-time system is both linear and time-invariant, then the output y(t) is related to
the input x(t) by a convolution integral convolution integral
= x(t)*h(t)
31
IES College of Technology, Bhopal Signal and System
Program:
clc;
close all;
clear all;
%program for signal convolution
t=0:0.1:10;
x1=sin(2*pi*t);
h1=cos(2*pi*t);
y1=conv(x1,h1);
figure;
subplot(3,1,1);
plot(t,x1);
xlabel('t');
ylabel('x(t)');
title('input signal')
subplot(3,1,2);
plot(t,h1);
xlabel('t');
ylabel('h(t)');
title('impulse response')
subplot(3,1,3);
plot(y1);
xlabel('n');
ylabel('y(n)');
title('linear convolution');
RESULT: convolution between signals is computed.
32
IES College of Technology, Bhopal Signal and System
Output:
******************************
33
IES College of Technology, Bhopal Signal and System
Experiment No 7
7(b) Aim:- To demonstrate the correlation of two continuous-time signals.
Required: Computer with MATLAB software
Theory: Correlation is a measure of the similarities between two signals as a function of
time shift between them.
Correlations of sequences:
It is a measure of the degree to which two sequences are similar. Given two real-valued
sequences x(t) and y(t) of finite energy,
Convolution involves the following operations.
1. Shifting
2. Multiplication
3. Addition
These operations can be represented by a Mathematical Expression as follows:
Cross correlation: Correlation of a signal with another signal is called Cross correlation.
The Cross correlation function for two periodic or power signals s1(t) and s2(t),
34
IES College of Technology, Bhopal Signal and System
Program:
clc;
close all;
clear all;
% cross correlation between two signals
% generating two input signals
t=0:0.2:10;
x1=3*exp(-2*t);
h1=exp(t);
figure;
subplot(2,2,1);
plot(t,x1);
xlabel('t');
ylabel('x1(t)');
title('input signal');
subplot(2,2,2);
plot(t,h1);
xlabel('t');
ylabel('h1(t)');
title('impulse signal');
% cross correlation
subplot(2,2,3);
z1=xcorr(x1,h1);
plot(z1);
xlabel('t');
ylabel('z1(t)');
title('cross correlation ');
% auto correlation
subplot(2,2,4);
z2=xcorr(x1,x1);
plot(z2);
xlabel('t');
ylabel('z2(t)');
title('auto correlation ');
35
IES College of Technology, Bhopal Signal and System
Output:
******************************
36
IES College of Technology, Bhopal Signal and System
Experiment No 8
Objective: To demonstrate the convolution and correlation of two discrete-time signals.
Theory: Convolution is a mathematical operation used for describing the input –output
relationship in a linear time-invariant system.
If x(n)=h(n) [ impulse ) then output y(n) is known as impulse response of the system.
x(n) = δ(n)
y(n) = T[x(n)]=h(n)
similarly δ (n-k)= h(n-k)
Thus output of LTI system is geven by weighted sum of time-shifted impulse responses
Linear Convolution equation
Linear Convolution involves the following operations.
1. Folding 2. Multiplication 3. Addition
4. Shifting
These operations can be represented by a Mathematical Expression as follows:
37
IES College of Technology, Bhopal Signal and System
Program:
clc;
close all;
clear all;
%program for convolution of two sequences
x=input('enter input sequence');
h=input('enter impulse response');
y=conv(x,h);
subplot(3,1,1);
stem(x);
xlabel('n');
ylabel('x(n)');
title('input signal')
subplot(3,1,2);
stem(h);
xlabel('n');
ylabel('h(n)');
title('impulse response')
subplot(3,1,3);
stem(y);
xlabel('n');
ylabel('y(n)');
title('linear convolution')
disp('The resultant signal is');
disp(y)
Output:
enter input sequence[2 4 6 8]
enter impulse response[1 3 9 6]
The resultant signal is
2 10 36 74 102 108 48
38
IES College of Technology, Bhopal Signal and System
Experiment No 8
Objective: To demonstrate the convolution and correlation of two discrete-time signals.
Correlations of sequences:
It is a measure of the degree to which two sequences are similar. Given two real-valued
sequences x(n) and y(n) of finite energy,
Cross correlation: Correlation of a signal with another signal is called Cross correlation.
39
IES College of Technology, Bhopal Signal and System
Program:
clc;
close all;
clear all;
% two input sequences
x=input('enter input sequence');
h=input('enter the impulse suquence');
subplot(2,2,1);
stem(x);
xlabel('n');
ylabel('x(n)');
title('input sequence');
subplot(2,2,2);
stem(h);
xlabel('n');
ylabel('h(n)');
title('impulse signal');
% cross correlation between two sequences
y=xcorr(x,h);
subplot(2,2,3);
stem(y);
xlabel('n');
ylabel('y(n)');
title(' cross correlation between two sequences ');
% auto correlation of input sequence
z=xcorr(x,x);
subplot(2,2,4);
stem(z);
xlabel('n');
ylabel('z(n)');
title('auto correlation of input sequence');
Result: Auto correlation and Cross correlation between signals and sequences is computed.
******************************
40
IES College of Technology, Bhopal Signal and System
Experiment No 9
Objective: To determine Magnitude and Phase Response of Fourier Transform of given
signals.
Theory: Fourier Transform: The Fourier transform as follows. Suppose that ƒ is a function
which is zero outside of some interval [−L/2, L/2]. Then for any T ≥ L we may expand ƒ in a
Fourier series on the interval [−T/2,T/2], where the "amount" of the wave e2πinx/T in the
Fourier series of ƒ is given by definition Fourier Transform of signal f(t) is defined as
Program:
clc;
A=1;
Dt=0.005;
t=-4.5:Dt:4.5;
xt=exp(-A*abs (t));
Wmax=2*%pi*1;
K=4;
k=0:(K/1000):K;
W=k*Wmax/K;
XW=xt*exp(-sqrt(-1)*t'*W)*Dt;
XW = real (XW);
W=[-mtlb_fliplr(W),W(2:1001)];
XW=[mtlb_fliplr(XW),XW(2:1001)];
subplot(1,1,1)
subplot(2,1,1);
a=gca();
a.y_location="origin";
plot(t,xt);
xlabel( ' t in sec. ' );
ylabel( ' x(t) ' )
title( ' Continuous Time Signal ' )
subplot(2,1,2);
a=gca();
a.y_location="origin";
plot(W,XW);
xlabel( ' Frequency in Radians / Seconds W' );
ylabel( 'X(jW) ' )
title(' Continuous time Fourier Transform ' )
Output:
41
IES College of Technology, Bhopal Signal and System
******************************
42