Bs Lab Manual
Transcript of Bs Lab Manual
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Laboratory manual
for
BASIC SIMULATION LAB
II B. Tech I Semester
By
Mr. J. Sunil Kumar
&
Mrs. P. Saritha
Department of Electronics & Communication Engineering
Turbomachinery Institute of Technology & Sciences
(Approved by AICTE & Affiliated to JNTUH)
Indresam(v), Patancheru(M), Medak(Dist)
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Turbomachinery Institute of Technology & Sciences
Certificate
This is to certify that Mr. / Ms. ………………………………….. RollNo……………..… of I/II/III/IV
B.Tech I / II Semester of …………….……………………..…………branch has completed the laboratory work
satisfactorily in …………………..…….……..... Lab for the academic year 20 … to 20 …as prescribed in the
curriculum.
Place: …………….….
Date: ……………..….
Lab In charge Head of the Department Principal
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
INSTRUCTIONS FOR STUDENTS
Students shall read the points given below for understanding the theoretical concepts and practical applications.
1. Listen carefully to the lecture given by teacher about importance of subject, curriculum philosophy, Learning
structure, skills to be developed, information about equipment, instruments, procedure, method of continuous
assessment, tentative plan of work in laboratory and total amount of work to be done in a semester.
2. Students shall undergo study visit of the laboratory for types of equipment, instruments and material to be used,
before performing experiments.
3. Read the write up of each experiment to be performed, a day in advance.
4. Organize the work in the group and make a record of all observations.
5. Understand the purpose of experiment and its practical implications.
6. Student should not hesitate to ask any difficulty faced during conduct of practical / exercise.
7. Student shall develop maintenance skills as expected by the industries.
8. Student should develop the habit of pocket discussion / group discussion related to the experiments/ exercises so
that exchanges of knowledge / skills could take place.
9. Student should develop habit to submit the practical, exercise continuously and progressively on the scheduled dates
and should get the assessment done.
10. Student shall attempt to develop related hands - on - skills and gain confidence.
11. Student shall focus on development of skills rather than theoretical or codified knowledge.
12. Student shall visit the nearby workshops, workstation, industries, laboratories, technical exhibitions trade fair etc.
even not included in the Lab Manual. In short, students should have exposure to the area of work right in the student
hood.
13. Student shall develop the habit of evolving more ideas, innovations, skills etc. those included in the scope of the
manual.
14. Student shall refer to technical magazines, proceedings of the Seminars, refer websites related to the scope of the
subjects and update their knowledge and skills..
15. The student shall study all the questions given in the laboratory manual and practice to write the answers to these
questions.
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
INDEX
S.no Name of the Experiment Page
No
Date of
Perform
ance
Date
of
Submi
ssion
Assessmen
t marks
(Max 10)
Sign.
of
Facult
y
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11
12
13
14
15
16
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
List of Experiments:
1. Basic Operations on Matrices.
2. Generation of Various Signals and Sequences (Periodic and Aperiodic), such as Unit impulse, unit
step, square, saw tooth, triangular, sinusoidal, ramp, sinc.
3. Observations on signals and sequences such as addition, multiplication, scaling , shifting, folding,
computation of energy and average power.
4. Finding the even and odd parts of signal/ sequence and real and imaginary parts of signal.
5. Convolution between signals and sequences.
6. Autocorrelation and cross correlation between signals and sequences.
7. Verification of linearity and time invariance properties of a given continuous/discrete system.
8. Computation of unit sample, unit step and sinusoidal responses of the given LTI system and
verifying its physical realizability and stability properties.
9. Gibbs phenomenon.
10. Finding the Fourier transform of a given signal and plotting its magnitude and phase spectrum.
11. Waveform synthesis using Laplace Tronsform.
12. Locating the zeros and poles and plotting the pole-zero maps in S plane and Z-plane for the given
transfer function.
13. Generation of Gaussian noise (real and complex), computation of its mean, M.S. Value and its Skew,
Kurtosis, and PSD, Probability Distribution Function.
14. Sampling theorem verification.
15. Removal of noise by autocorrelation / cross correlation.
16. Extraction of periodic signal masked by noise using correlation.
17. Verification of winer-khinchine relations.
18. Checking a random process for stationarity in wide sense.
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Exp. No: 1 Date:
BASIC OPERATIONS ON MATRICES
Aim: To generate matrix and perform basic operation on matrices Using MATLAB Software.
Equipments: PC with windows (95/98/XP/NT/2000).
MATLAB Software
Theory:
MATLAB treats all variables as matrices. For our purposes a matrix can be thought of as an array, in fact,
that is how it is stored.
• Vectors are special forms of matrices and contain only one row OR one column.
• Scalars are matrices with only one row AND one column.A matrix with only one row AND one
column is a scalar. A scalar can be reated in MATLAB as follows:
» a_value=23
a_value =23
• A matrix with only one row is called a row vector. A row vector can be created in MATLAB as
follows :
» rowvec = [12 , 14 , 63]
rowvec = 12 14 63
• A matrix with only one column is called a column vector. A column vector can be created in
MATLAB as follows:
» colvec = [13 ; 45 ; -2]
colvec =
13
45
-2
• A matrix can be created in MATLAB as follows:
» matrix = [1 , 2 , 3 ; 4 , 5 ,6 ; 7 , 8 , 9]
matrix =
1 2 3
4 5 6
7 8 9
Extracting a Sub-Matrix
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
A portion of a matrix can be extracted and stored in a smaller matrix by specifying the names of both
matrices and the rows and columns to extract. The syntax is:
sub_matrix = matrix ( r1 : r2 , c1 : c2 ) ;
Where r1 and r2 specify the beginning and ending rows and c1 and c2 specify the beginning and ending
columns to be extracted to make the new matrix.
• A column vector can beextracted from a matrix.
• As an example we create a matrix below:
» matrix=[1,2,3;4,5,6;7,8,9]
matrix =
1 2 3
4 5 6
7 8 9
Here we extract column 2 of the matrix and make a column vector:
» col_two=matrix( : , 2)
col_two =
2 5 8
• A row vector can be extracted from a matrix.
As an example we create a matrix below:
» matrix=[1,2,3;4,5,6;7,8,9]
matrix =
1 2 3
4 5 6
7 8 9
• Here we extract row 2 of the matrix and make a row vector. Note that the 2:2 specifies the second
row and the 1:3 specifies which columns of the row.
» rowvec=matrix(2 : 2 , 1 :3)
rowvec =4 5 6
» a=3;
» b=[1, 2, 3;4, 5, 6]
b =
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
1 2 3
4 5 6
» c= b+a % Add a to each element of b
c =
4 5 6
7 8 9
• Scalar - Matrix Subtraction
» a=3;
» b=[1, 2, 3;4, 5, 6]
b =
1 2 3
4 5 6
» c = b - a %Subtract a from each element of b
c =
-2 -1 0
1 2 3
• Scalar - Matrix Multiplication
» a=3;
» b=[1, 2, 3; 4, 5, 6]
b =
1 2 3
4 5 6
» c = a * b % Multiply each element of b by a
c =
3 6 9
12 15 18
• Scalar - Matrix Division
» a=3;
» b=[1, 2, 3; 4, 5, 6]
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
b =
1 2 3
4 5 6
» c = b / a % Divide each element of b by a
c =
0.3333 0.6667 1.0000
1.3333 1.6667 2.0000
a = [1 2 3 4 6 4 3 4 5]
a =
1 2 3 4 6 4 3 4 5
b = a + 2
b =
3 4 5 6 8 6 5 6 7
A = [1 2 0; 2 5 -1; 4 10 -1]
A =
1 2 0
2 5 -1
4 10 -1
B = A'
B =
1 2 4
2 5 10
0 -1 -1
C = A * B
C =
5 12 24
12 30 59
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
24 59 117
Instead of doing a matrix multiply, we can multiply the corresponding elements of two matrices or
vectors using the .* operator.
C = A .* B
C =
1 4 0
4 25 -10
0 -10 1
Let's find the inverse of a matrix …
X = inv(A)
X =
5 2 -2
-2 -1 1
0 -2 1
and then illustrate the fact that a matrix times its inverse is the identity matrix.
I = inv(A) * A
I =
1 0 0
0 1 0
0 0 1
to obtain eigenvalues
eig(A)
ans =
3.7321
0.2679
1.0000
as the singular value decomposition.
svd(A)
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
ans =
12.3171
0.5149
0.1577
CONCLUSION: Inthis experiment basic operations on matrices Using MATLAB have been demonstrated.
3. Perform following operations on any two matrices
A+B
A-B
A*B
A.*B
A/B
A./B
A\B
A.\B
A^B,A.^B,A',A.
4. Enter the following matrix at the command window and perform the following
A= [3 4 5 1
5 6 7 2
7 8 9 3]
i. All the elements of all rows but first column
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
ii. All the elements of first row but all columns
iii. Element in second row and third column
iv. Reshape this matrix to (4×3) matrix
v. Determine inverse , Determinant ,rank, size, transpose, eigen values, of A
vii. Multiply A with another Matrix B
viii. perform arry multiplication of A and B
5. x= [2 3 4] ; y=[2 5 1] perform all logical operations (AND, OR, NOT, EXOR)
6. Perform following operations on any two matrices
A+B, A-B, A*B, A.*B, A/B, A./B, A^B, A.^B, A',A
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
EXP.NO: 2 Date:
GENERATION ON VARIOUS SIGNALS AND SEQUENCES
(PERIODIC AND APERIODIC), SUCH AS UNIT IMPULSE, UNIT STEP, SQUARE,
SAWTOOTH, TRIANGULAR, SINUSOIDAL, RAMP, SINC.
Aim: To generate different types of signals Using MATLAB Software.
Equipments: PC with windows (95/98/XP/NT/2000).
MATLAB Software
Theory :
Unit Impulse: a) Continuous signal:
And
Also called unit impulse function. The value of delta function can also be defined in the sense of
generalized function
φ(t): Test Function
b) Unit Sample sequence: δ(n)= 1, n=0
0, n≠0
i.e
1)( =∫∞
∞−dttδ
=∞
≠=
0
00)(
t
ttδ
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Matlab program:
%unit impulse generation
clc
close all
n1=-3;
n2=4;
n0=0;
n=[n1:n2];
x=[(n-n0)==0]
stem(n,x)
2) Unit Step Function u(t):
b) Unit Step Sequence u(n): )= 1, n ≥ 0
0, n < 0
% unit step generation
n1=-4;
<
>=
00
01)(
t
ttu
∫∫∞∞
∞−=
0)()()( dttdtttu φφ
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
n2=5;
n0=0;
[y,n]=stepseq(n0,n1,n2);
stem(n,y);
xlabel('n')
ylabel('amplitude');
title('unit step');
Square waves: Like sine waves, square waves are described in terms of period, frequency and amplitude:
Peak amplitude, Vp , and peak-to-peak amplitude, Vpp , are measured as you might expect. However,
the rms amplitude, Vrms , is greater than that of a sine wave. Remember that the rms amplitude is the DC
voltage which will deliver the same power as the signal. If a square wave supply is connected across a lamp,
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
the current flows first one way and then the other. The current switches direction but its magnitude remains
the same. In other words, the square wave delivers its maximum power throughout the cycle so that Vrms is
equal to Vp . (If this is confusing, don't worry, the rms amplitude of a square wave is not something you need
to think about very often.)
Although a square wave may change very rapidly from its minimum to maximum voltage, this
change cannot be instantaneous. The rise time of the signal is defined as the time taken for the voltage to
change from 10% to 90% of its maximum value. Rise times are usually very short, with durations measured
in nanoseconds (1 ns = 10-9
s), or microseconds (1 µs = 10-6
s), as indicated in the graph
% square wave generator
fs = 1000;
t = 0:1/fs:1.5;
x1 = sawtooth(2*pi*50*t);
x2 = square(2*pi*50*t);
subplot(2,2,1),plot(t,x1), axis([0 0.2 -1.2 1.2])
xlabel('Time (sec)');
ylabel('Amplitude');
title('Sawtooth Periodic Wave')
subplot(2,2,2);
plot(t,x2);
axis([0 0.2 -1.2 1.2])
xlabel('Time (sec)');
ylabel('Amplitude');
title('Square Periodic Wave');
subplot(2,2,3);
stem(t,x2);
axis([0 0.1 -1.2 1.2])
xlabel('Time (sec)');
ylabel('Amplitude');
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Sawtooth:
The sawtooth wave (or saw wave) is a kind of non-sinusoidal waveform. It is named a sawtooth based
on its resemblance to the teeth on the blade of a saw. The convention is that a sawtooth wave ramps upward
and then sharply drops. However, there are also sawtooth waves in which the wave ramps downward and
then sharply rises. The latter type of sawtooth wave is called a 'reverse sawtooth wave' or 'inverse sawtooth
wave'. As audio signals, the two orientations of sawtooth wave sound identical. The piecewise linear function
based on the floor function of time t, is an example of a sawtooth wave with period 1.
A more general form, in the range −1 to 1, and with period a. This sawtooth function has the same phase as
the sine function. A sawtooth wave's sound is harsh and clear and its spectrum contains both even and odd
harmonics of the fundamental frequency. Because it contains all the integer harmonics, it is one of the best
waveforms to use for synthesizing musical sounds, particularly bowed string instruments like violins and
cellos, using subtractive synthesis.
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Applications
The sawtooth and square waves are the most common starting points used to create sounds with
subtractive analog and virtual analog music synthesizers. The sawtooth wave is the form of the vertical and
horizontal deflection signals used to generate a raster on CRT-based television or monitor screens.
Oscilloscopes also use a sawtooth wave for their horizontal deflection, though they typically use electrostatic
deflection. On the wave's "ramp", the magnetic field produced by the deflection yoke drags the electron beam
across the face of the CRT, creating a scan line. On the wave's "cliff", the magnetic field suddenly collapses,
causing the electron beam to return to its resting position as quickly as possible. The voltage applied to the
deflection yoke is adjusted by various means (transformers, capacitors, center-tapped windings) so that the
half-way voltage on the sawtooth's cliff is at the zero mark, meaning that a negative voltage will cause
deflection in one direction, and a positive voltage deflection in the other; thus, a center-mounted deflection
yoke can use the whole screen area to depict a trace. Frequency is 15.734 kHz on NTSC, 15.625 kHz for
PAL and SECAM)
% sawtooth wave generator
fs = 10000;
t = 0:1/fs:1.5;
x = sawtooth(2*pi*50*t);
subplot(1,2,1);
plot(t,x) ;
axis([0 0.2 -1 1]);
xlabel('t') ;
ylabel('x(t)');
title('sawtooth signal');
N=2;
fs = 500;
n = 0:1/fs:2;
x = sawtooth(2*pi*50*n);
subplot(1,2,2);
stem(n,x);
axis([0 0.2 -1 1]);
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
xlabel('n'),ylabel('x(n)')
title('sawtooth sequence');
Triangle wave
A triangle wave is a non-sinusoidal waveform named for its triangular shape. A band limited triangle
wave pictured in the time domain (top) and frequency domain (bottom). The fundamental is at 220 Hz
(A2).Like a square wave, the triangle wave contains only odd harmonics. However, the higher harmonics roll
off much faster than in a square wave (proportional to the inverse square of the harmonic number as opposed
to just the inverse).It is possible to approximate a triangle wave with additive synthesis by adding odd
harmonics of the fundamental, multiplying every (4n−1)th harmonic by −1 (or changing its phase by π), and
rolling off the harmonics by the inverse square of their relative frequency to the fundamental. This infinite
Fourier series converges to the triangle wave:
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
To generate a trianguular pulse
A=2; t = 0:0.0005:1;
x=A*sawtooth(2*pi*5*t,0.25); %5 Hertz wave with duty cycle 25%
plot(t,x);
grid
axis([0 1 -3 3]);
%%To generate a trianguular pulse
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
fs = 10000;t = -1:1/fs:1;
x1 = tripuls(t,20e-3); x2 = rectpuls(t,20e-3);
subplot(211),plot(t,x1), axis([-0.1 0.1 -0.2 1.2])
xlabel('Time (sec)');ylabel('Amplitude'); title('Triangular Aperiodic Pulse')
subplot(212),plot(t,x2), axis([-0.1 0.1 -0.2 1.2])
xlabel('Time (sec)');ylabel('Amplitude'); title('Rectangular Aperiodic Pulse')
set(gcf,'Color',[1 1 1]),
%%To generate a rectangular pulse
t=-5:0.01:5;
pulse = rectpuls(t,2); %pulse of width 2 time units
plot(t,pulse)
axis([-5 5 -1 2]);
grid
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Sinusoidal Signal Generation
The sine wave or sinusoid is a mathematical function that describes a smooth repetitive oscillation. It occurs
often in pure mathematics, as well as physics, signal processing, electrical engineering and many other fields.
Its most basic form as a function of time (t) is:
where:
• A, the amplitude, is the peak deviation of the function from its center position.
• ω, the angular frequency, specifies how many oscillations occur in a unit time interval, in radians per
second
• φ, the phase, specifies where in its cycle the oscillation begins at t = 0.
A sampled sinusoid may be written as:
where f is the signal frequency, fs is the sampling frequency, θ is the phase and A is the amplitude of the
signal. The program and its output is shown below: Note that there are 64 samples with sampling frequency
of 8000Hz or sampling time of 0.125 mS (i.e. 1/8000). Hence the record length of the signal is
64x0.125=8mS. There are exactly 8 cycles of sinewave, indicating that the period of one cycle is 1mS which
means that the signal frequency is 1KHz.
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
% sinusoidal signal
N=64; % Define Number of samples
n=0:N-1; % Define vector n=0,1,2,3,...62,63
f=1000; % Define the frequency
fs=8000; % Define the sampling frequency
x=sin(2*pi*(f/fs)*n); % Generate x(t)
plot(n,x); % Plot x(t) vs. t
title('Sinewave [f=1KHz, fs=8KHz]');
xlabel('Sample Number');
ylabel('Amplitude');
% RAMP
clc
close all
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
n=input('enter the length of ramp');
t=0:n;
plot(t);
xlabel('t');
ylabel('amplitude');
title ('ramp')
Sinc function:
The sinc function computes the mathematical sinc function for an input vector or matrix x. Viewed as a
function of time, or space, the sinc function is the inverse Fourier transform of the rectangular pulse in
frequency centered at zero of width 2π and height 1. The following equation defines the sinc function:
The sinc function has a value of 1 whenx is equal to zero, and a value of
% sinc
x = linspace(-5,5);
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
y = sinc(x);
subplot(1,2,1);plot(x,y)
xlabel(‘time’);
ylabel(‘amplitude’);
title(‘sinc function’);
subplot(1,2,2);stem(x,y);
xlabel(‘time’);
ylabel(‘amplitude’);
title(‘sinc function’);
Conclusion: In this experiment various signals have been generated Using MATLAB
Exercise Questions: Generate following signals using MATLAB
1. x(t)=e-t
2. x(t)= t 2 / 2
3. Generate rectangular pulse function
4. Generate signum sunction sinc(t)= 1 t > 0
0 t=0
-1 t<0
5. Generate complex exponential signal x(t)= e st for different values of σ and Ω
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Exp. No: 3 Date:
OPERATIONS ON SIGNALS AND SEQUENCES SUCH AS ADDITION,
MULTIPLICATION, SCALING, SHIFTING, FOLDING, COMPUTATION OF ENERGY AND
AVERAGE POWER
Aim: To perform arithmetic operations different types of signals Using MATLAB Software.
Equipments: PC with windows (95/98/XP/NT/2000).
MATLAB Software
Theory :
Basic Operation on Signals:
Time shifting: y(t)=x(t-T)The effect that a time shift has on the appearance of a signal If T is a positive
number, the time shifted signal, x (t -T ) gets shifted to the right, otherwise it gets shifted left.
Signal Shifting and Delay:
. Shifting : y(n)=x(n-k) ; m=n-k; y=x;
Time reversal: Y(t)=y(-t) Time reversal _ips the signal about t = 0 as seen in
Figure 1.
Signal Addition and Subtraction:
Addition: any two signals can be added to form a third signal,
z (t) = x (t) + y (t)
Signal Amplification/Atténuation:
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Multiplication/Division: of two signals, their product is also a signal.
z (t) = x (t) y (t)
folding: y(n)=x(-n) ; y=fliplr(x); n=-fliplr(n);
%plot the 2 Hz sine wave in the top panel
t = [0:.01:1]; % independent (time) variable
A = 8; % amplitude
f1 = 2; % create a 2 Hz sine wave lasting 1 sec
s1 = A*sin(2*pi*f1*t);
f2 = 6; % create a 4 Hz sine wave lasting 1 sec
s2 = A*sin(2*pi*f2*t);
figure
subplot(4,1,1)
plot(t, s1)
title('1 Hz sine wave')
ylabel('Amplitude')
%plot the 4 Hz sine wave in the middle panel
subplot(4,1,2)
plot(t, s2)
title('2 Hz sine wave')
ylabel('Amplitude')
%plot the summed sine waves in the bottom panel
subplot(4,1,3)
plot(t, s1+s2)
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
title('Summed sine waves')
ylabel('Amplitude')
xlabel('Time (s)')
xmult=s1.*s2;
subplot(4,1,4);
plot(xmult);
title('multiplication');
ylabel('Amplitude')
xlabel('Time (s)')
%signal folding
clc; clear all
t=0:0.1:10;
x=0.5*t;
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
lx=length(x);
nx=0:lx-1;
xf=fliplr(x);
nf=-fliplr(nx);
subplot(2,1,1);
stem(nx,x);
xlabel('nx');
ylabel('x(nx)');
title('original signal');
subplot(2,1,2);
stem(nf,xf);
xlabel('nf');
ylabel('xf(nf)');
title('folded signal');
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
%plot the 2 Hz sine wave scalling
t = [0:.01:1]; % independent (time) variable
A = 8; % amplitude
f1 = 2; % create a 2 Hz sine wave lasting 1 sec
s1 = A*sin(2*pi*f1*t);
subplot(3,2,1)
plot(s1);
xlabel('t');
ylabel('amplitude');
s2=2*s1;
subplot(3,2,2)
plot(s2);
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
xlabel('t');
ylabel('amplitude');
s3=s1/2;
subplot(3,2,3)
plot(s3);
xlabel('t');
ylabel('amplitude');
subplot(3,2,4)
stem(s1);
xlabel('t');
ylabel('amplitude');
s2=2*s1;
subplot(3,2,5)
stem(s2);
xlabel('t');
ylabel('amplitude');
s3=s1/2;
subplot(3,2,6)
stem(s3);
xlabel('t');
ylabel('amplitude');
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Exercise Questions: Sketch the following questions using MATLAB
1. x(t)= u(-t+1)
2. x(t)=3r(t-1)
3. x(t)=U(n+2-u(n-3)
4. x(n)=x1(n)+x2(n)where x1(n)=1,3,2,1,x2(n)=1,-2,3,2
5. x(t)=r(t)-2r(t-1)+r(t-2)
6. x(n)=2δ(n+2)-2δ(n-4), -5≤ n ≥5.
7. X(n)=1,2,3,4,5,6,7,6,5,4,2,1 determine and plot the following sequence
a. x1(n)=2x(n-5-3x(n+4))
b. x2(n)=x(3-n)+x(n)x(n-2)
Conclusion: In this experiment the various operations on signals have been performed. Using MATLAB
has been demonstrated.
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Exp. No : 4 Date:
FINDING THE EVEN AND ODD PARTS OF SIGNAL/SEQUENCE AND REAL AND IMAGINARY
PART OF SIGNAL
Aim: program for finding even and odd parts of signals Using MATLAB Software.
Equipments: PC with windows (95/98/XP/NT/2000).
MATLAB Software
Theory : Even and Odd Signal
One of characteristics of signal is symmetry that may be useful for signal analysis. Even signals are
symmetric around vertical axis, and Odd signals are symmetric about origin.
Even Signal: A signal is referred to as an even if it is identical to its time-reversed counterparts; x(t) = x(-t).
Odd Signal: A signal is odd if x(t) = -x(-t). An odd signal must be 0 at t=0, in other words, odd signal
passes the origin. Using the definition of even and odd signal, any signal may be decomposed into a sum of
its even part, xe(t), and its odd part, xo(t), as follows:
It is an important fact because it is relative concept of Fourier series. In Fourier series, a periodic signal can
be broken into a sum of sine and cosine signals. Notice that sine function is odd signal and cosine function is
even signal.
%even and odd signals program:
t=-4:1:4;
h=[ 2 1 1 2 0 1 2 2 3 ];
subplot(3,2,1)
stem(t,h);
xlabel('time'); ylabel('amplitude');
title('signal');
n=9;
for i=1:9
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
x1(i)=h(n);
n=n-1;
end
subplot(3,2,2)
stem(t,x1);
xlabel('time');
ylabel('amplitude');
title('folded signal');
z=h+x1
subplot(3,2,3);
stem(t,z);
xlabel('time'); ylabel('amplitude');
title('sum of two signal');
subplot(3,2,4);
stem(t,z/2);
xlabel('time'); ylabel('amplitude');
title('even signal');
a=h-x1;
subplot(3,2,5);
stem(t,a);
xlabel('time'); ylabel('amplitude');
title('difference of two signal');
subplot(3,2,6);
stem(t,a/2);
xlabel('time'); ylabel('amplitude');
title('odd signal');
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Energy and Power Signal: A signal can be categorized into energy signal or power signal: An energy
signal has a finite energy, 0 < E < ∞. In other words, energy signals have values only in the limited time
duration. For example, a signal having only one square pulse is energy signal. A signal that decays
exponentially has finite energy, so, it is also an energy signal. The power of an energy signal is 0, because of
dividing finite energy by infinite time (or length).
On the contrary, the power signal is not limited in time. It always exists from beginning to end and it never
ends. For example, sine wave in infinite length is power signal. Since the energy of a power signal is infinite,
it has no meaning to us. Thus, we use power (energy per given time) for power signal, because the power of
power signal is finite, 0 < P < ∞.
% energy
clc;
close all;
clear all;
x=[1,2,3];
n=3
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
e=0;
for i=1:n;
e=e+(x(i).*x(i));
end
% energy
clc;
close all;
clear all;
N=2
x=ones(1,N)
for i=1:N
y(i)=(1/3)^i.*x(i);
end
n=N;
e=0;
for i=1:n;
e=e+(y(i).*y(i));
end
% power
clc;
close all;
clear all;
N=2
x=ones(1,N)
for i=1:N
y(i)=(1/3)^i.*x(i);
end
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
n=N;
e=0;
for i=1:n;
e=e+(y(i).*y(i));
end
p=e/(2*N+1);
% power
N=input('type a value for N');
t=-N:0.0001:N;
x=cos(2*pi*50*t).^2;
disp('the calculated power p of the signal is');
P=sum(abs(x).^2)/length(x)
plot(t,x);
axis([0 0.1 0 1]);
disp('the theoretical power of the signal is');
P_theory=3/8
Conclusion: In this experiment even and odd parts of various signals and energy and power of signals have
been calculated Using MATLAB
Exercise Questions: find even and odd parts of the following signals
1. x(n)= e(-0.1+j0.3)n
,- 10≤n≤10
2. Calculate the following signals energies
3. x(t)=u(t)-u(t-15)
4. cos(10∏t)u(t)u(2-t-5)
5. Calculate the following signals energies
a. x(t)= e
j(2t+∏/4)
b. x(t)=cos(t)
c. x(t)=cos(∏/4) n
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
EXP.NO: 5 Date:
LINEAR CONVOLUTION
Aim: To find the out put with linear convolution operation Using MATLAB Software.
Equipments: PC with windows (95/98/XP/NT/2000).
MATLAB Software
Theory:
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:
x[ ]= Input signal Samples
h[ ]= Impulse response co-efficient.
y[ ]= Convolution output.
n = No. of Input samples
h = No. of Impulse response co-efficient.
Example : X(n)=1 2 -1 0 1, h(n)= 1,2,3,-1
Program:
clc;
close all;
clear all;
x=input('enter input sequence');
h=input('enter impulse response');
y=conv(x,h);
subplot(3,1,1);
stem(x);
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
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)
Linear Convolution
output:
enter input sequence[1 4 3 2]
enter impulse response[1 0 2 1]
The resultant signal is
1 4 5 11 10 7 2
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Conclusion: In this experiment convolution of various signals have been performed Using MATLAB
Applications:
Convolution is used to obtain the response of an LTI system to an arbitrary input signal.It is used to find the
filter response and finds application in speech processing and radar signal processing.
Exercise Questions: perform convolution between the following signals
1. X(n)=[1 -1 4 ], h(n) = [ -1 2 -3 1]
2. Perform convolution between the. Two periodic sequences
x1(t)=e-3t
u(t)-u(t-2) , x2(t)= e -3t
for 0 ≤ t ≤ 2
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
EXP.NO: 6 Date:
6. AUTO CORRELATION AND CROSS CORRELATION BETWEEN
SIGNALS AND SEQUENCES.
Aim: To compute auto correlation and cross correlation between signals and sequences
Equipments: PC with windows (95/98/XP/NT/2000).
MATLAB Software
Theory:
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,
Convolution involves the following operations.
1. Shifting
2. Multiplication
3. Addition
These operations can be represented by a Mathematical Expression as follows:
Crosscorrelation
The index l is called the shift or lag parameter
Autocorrelation
The special case: y(n)=x(n)
% Cross Correlation
clc;
close all;
clear all;
x=input('enter input sequence');
h=input('enter the impulse suquence');
∑+∞
−∞=
−=n
yx lnynxlr )()()(,
∑+∞
−∞=
−=n
xx lnxnxlr )()()(,
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
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 signal');
y=xcorr(x,h);
subplot(3,1,3);
stem(y);
xlabel('n');
ylabel('y(n)');
disp('the resultant signal is');
disp(y);
title('correlation signal');
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
% auto correlation
clc;
close all;
clear all;
x = [1,2,3,4,5]; y = [4,1,5,2,6];
subplot(3,1,1);
stem(x);
xlabel('n');
ylabel('x(n)');
title('input signal');
subplot(3,1,2);
stem(y);
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
xlabel('n');
ylabel('y(n)');
title('input signal');
z=xcorr(x,x);
subplot(3,1,3);
stem(z);
xlabel('n');
ylabel('z(n)');
title('resultant signal signal');
Conclusion: In this experiment correlation of various signals has been performed. Using MATLAB
Applications: It is used to measure the degree to which the two signals are similar and it is also used for
radar detection by estimating the time delay. It is also used in Digital communication, defence applications
and sound navigation
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Exercise Questions: perform convolution between the following signals
1. X(n)=[1 -1 4 ], h(n) = [ -1 2 -3 1]
2. Perform convolution between the. Two periodic sequences
x1(t)=e-3t
u(t)-u(t-2) , x2(t)= e -3t
for 0 ≤ t ≤ 2
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
EXP.NO: 7 Date:
VERIFICATION OF LINEARITY AND TIME INVARIANCE PROPERTIES OF
A GIVEN CONTINUOUS /DISCRETE SYSTEM.
Aim: To compute linearity and time invariance properties of a given continuous /discrete system
Equipments:
PC with windows (95/98/XP/NT/2000).
MATLAB Software
Theory:
Linearity Property
Program1:
clc;
clear all;
close all;
n=0:40; a=2; b=1;
x1=cos(2*pi*0.1*n);
x2=cos(2*pi*0.4*n);
x=a*x1+b*x2;
y=n.*x;
y1=n.*x1;
y2=n.*x2;
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
yt=a*y1+b*y2;
d=y-yt;
d=round(d)
if d
disp('Given system is not satisfy linearity property');
else
disp('Given system is satisfy linearity property');
end
subplot(3,1,1);
stem(n,y);
grid
subplot(3,1,2),
stem(n,yt);
subplot(3,1,3),
stem(n,d);
grid
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Program2:
clc;
clear all;
close all;
n=0:40;
a=2;
b=-3;
x1=cos(2*pi*0.1*n);
x2=cos(2*pi*0.4*n);
x=a*x1+b*x2;
y=x.^2;
y1=x1.^2;
y2=x2.^2;
yt=a*y1+b*y2;
d=y-yt;
d=round(d);
if d
disp('Given system is not satisfy linearity property');
else
disp('Given system is satisfy linearity property');
end
subplot(3,1,1);
stem(n,y);
grid;
subplot(3,1,2);
stem(n,yt);
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
grid
subplot(3,1,3);
stem(n,d);
grid;
Program
clc;
close all;
clear all;
x=input('enter the sequence');
N=length(x);
n=0:1:N-1;
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
y=xcorr(x,x);
subplot(3,1,1);
stem(n,x);
xlabel(' n----->');
ylabel('Amplitude--->');
title('input seq');
subplot(3,1,2);
N=length(y);
n=0:1:N-1;
stem(n,y);
xlabel('n---->');ylabel('Amplitude----.');
title('autocorr seq for input');
disp('autocorr seq for input');
disp(y)
p=fft(y,N);
subplot(3,1,3);
stem(n,p);
xlabel('K----->');ylabel('Amplitude--->');
title('psd of input');
disp('the psd fun:');
disp(p)
Linear Time Invariant Systems(LTI):
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Program1:
clc;
close all;
clear all;
n=0:40;
D=10;
x=3*cos(2*pi*0.1*n)-2*cos(2*pi*0.4*n);
xd=[zeros(1,D) x];
y=n.*xd(n+D);
n1=n+D;
yd=n1.*x;
d=y-yd;
if d
disp('Given system is not satisfy time shifting property');
else
disp('Given system is satisfy time shifting property');
end
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
subplot(3,1,1);
stem(y);
grid;
subplot(3,1,2);
stem(yd);
grid;
subplot(3,1,3);
stem(d);
grid;
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Program2:
clc;
close all;
clear all;
n=0:40;
D=10;
x=3*cos(2*pi*0.1*n)-2*cos(2*pi*0.4*n);
xd=[zeros(1,D) x];
x1=xd(n+D);
y=exp(x1);
n1=n+D;
yd=exp(xd(n1));
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
d=y-yd;
if d
disp('Given system is not satisfy time shifting property');
else
disp('Given system is satisfy time shifting property');
end
subplot(3,1,1);
stem(y);
grid;
subplot(3,1,2);
stem(yd);
subplot(3,1,3);
stem(d);
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Conclusion: In this experiment Linearity and Time invariance property of given system has bees verified
performed Using MATLAB
Applications: It is used to measure the degree to which the two signals are similar and it is also used for
radar detection by estimating the time delay. It is also used in Digital communication defence applications
and sound navigation
Exercise Questions: perform convolution between the following signals
1. X(n)=[1 -1 4 ], h(n) = [ -1 2 -3 1]
2. Perform convolution between the. Two periodic sequences
x1(t)=e-3t
u(t)-u(t-2) , x2(t)= e -3t
for 0 ≤ t ≤ 2
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
EXP.NO:8 Date:
COMPUTATION OF UNIT SAMPLE, UNIT STEP AND SINUSOIDAL RESPONSE OF THE
GIVEN LTI SYSTEM AND VERIFYING ITS PHYSICAL REALIZABILITY AND STABILITY
PROPERTIES.
Aim: To Unit Step And Sinusoidal Response Of The Given LTI System And Verifying Its Physical
Reliability And Stability Properties.
Equipments: PC with windows (95/98/XP/NT/2000).
MATLAB Software
A discrete time system performs an operation on an input signal based on predefined criteria to
produce a modified output signal. The input signal x(n) is the system excitation, and y(n) is the system
response. The transform operation is shown as,
If the input to the system is unit impulse i.e. x(n) = δ(n) then the output of the system is known as impulse
response denoted by h(n) where,
h(n) = T[δ(n)]
we know that any arbitrary sequence x(n) can be represented as a weighted sum of discrete impulses. Now
the system response is given by,
For linear system (1) reduces to
%given difference equation y(n)-y(n-1)+.9y(n-2)=x(n);
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
%calculate and plot the impulse response and step response
b=[1];
a=[1,-1,.9];
x=impseq(0,-20,120);
n = [-20:120];
h=filter(b,a,x);
subplot(3,1,1);stem(n,h);
title('impulse response');
xlabel('n');ylabel('h(n)');
=stepseq(0,-20,120);
s=filter(b,a,x);
s=filter(b,a,x);
subplot(3,1,2);
stem(n,s);
title('step response');
xlabel('n');ylabel('s(n)')
t=0:0.1:2*pi;
x1=sin(t);
%impseq(0,-20,120);
n = [-20:120];
h=filter(b,a,x1);
subplot(3,1,3);stem(h);
title('sin response');
xlabel('n');ylabel('h(n)');
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
figure;
zplane(b,a);
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Conclusion: In this experiment computation of unit sample, unit step and sinusoidal response of the given lti
system and verifying its physical realizability and stability properties Using MATLAB
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
EXP.NO: 9 Date:
GIBBS PHENOMENA
Aim: To verify the Gibbs Phenomenon.
Equipments: PC with windows (95/98/XP/NT/2000).
MATLAB Software
Theory:
The Gibbs phenomenon, the Fourier series of a piecewise continuously differentiable periodic function
behaves at a discontinuity. the n the approximated function shows amounts of ripples at the points of
discontinuity. This is known as the Gibbs Phenomena. Partial sum of the Fourier series has large oscillations
near the jump, which might increase the maximum of the partial sum above that of the function itself. The
overshoot does not die out as the frequency increases, but approaches a finite limit
The Gibbs phenomenon involves both the fact that Fourier sums overshoot at a jump discontinuity, and that
this overshoot does not die out as the frequency increases
Gibbs Phenomina Program :
t=0:0.1:(pi*8);
y=sin(t);
subplot(5,1,1);
plot(t,y);
xlabel('k');
ylabel('amplitude');
title('gibbs phenomenon');
h=2;
%k=3;
for k=3:2:9
y=y+sin(k*t)/k;
subplot(5,1,h);
plot(t,y);
xlabel('k');
ylabel('amplitude');
h=h+1;
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
end
Conclusion: In this experiment Gibbs phenomenon have been demonstrated Using MATLAB
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
EXP.NO: 10. Date:
FINDING THE FOURIER TRANSFORM OF A GIVEN SIGNAL AND PLOTTING ITS
MAGNITUDE AND PHASE SPECTRUM
Aim: to find the Fourier transform of a given signal and plotting its magnitude and phase spectrum
Equipments: PC with windows (95/98/XP/NT/2000).
MATLAB Software
Fourier Transform Theorems:
We may use Fourier series to motivate 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
By definition
Program:
Aim: To compute N-point FFT
Equipments: PC with windows (95/98/XP/NT/2000).
MATLAB Software
Theory:
DFT of a sequence X[K] = [ ] N
KnjN
K
enx
∏−−
=∑
21
0
Where N= Length of sequence.
K= Frequency Coefficient.
n = Samples in time domain.
FFT : -Fast Fourier transformer .
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
There are Two methods.
1. Decimation in time (DIT FFT).
2. Decimation in Frequency (DIF FFT).
Program:
clc;
close all;
clear all;
x=input('enter the sequence');
N=length(x);
n=0:1:N-1;
y=fft(x,N)
subplot(2,1,1);
stem(n,x);
title('input sequence');
xlabel('time index n----->');
ylabel('amplitude x[n]----> ');
subplot(2,1,2);
stem(n,y);
title('output sequence');
xlabel(' Frequency index K---->');
ylabel('amplitude X[k]------>');
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
FFT magnitude and Phase plot:
clc
close all
x=[1,1,1,1,zeros(1,4)];
N=8;
X=fft(x,N);
magX=abs(X),phase=angle(X)*180/pi;
subplot(2,1,1)
plot(magX);
grid
xlabel('k')
ylabel('X(K)')
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
subplot(2,1,2)
plot(phase);
grid
xlabel('k')
ylabel('degrees')
Applications:
The no of multiplications in DFT = N2.
The no of Additions in DFT = N(N-1).
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
For FFT.
The no of multiplication = N/2 log 2N.
The no of additions = N log2 N.
Conclusion: In this experiment the fourier transform of a given signal and plotting its magnitude and phase
spectrum have been demonstrated using matlab
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Exp:11 Date:
LAPLACE TRNASFORMS
Aim: To perform waveform synthesis using Laplece Trnasforms of a given signal
Bilateral Laplace transform :
When one says "the Laplace transform" without qualification, the unilateral or one-sided transform is
normally intended. The Laplace transform can be alternatively defined as the bilateral Laplace transform or
two-sided Laplace transform by extending the limits of integration to be the entire real axis. If that is done
the common unilateral transform simply becomes a special case of the bilateral transform where the
definition of the function being transformed is multiplied by the Heaviside step function.
The bilateral Laplace transform is defined as follows:
Inverse Laplace transform
The inverse Laplace transform is given by the following complex integral, which is known by various names
(the Bromwich integral, the Fourier-Mellin integral, and Mellin's inverse formula):
Program for Laplace Transform:
f=t
syms f t;
f=t;
laplace(f)
Program for inverse Laplace Transform
f(s)=24/s(s+8) invese LT
syms F s
F=24/(s*(s+8));
ilaplace(F)
y(s)=24/s(s+8) %inverse LT poles and zeros
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Signal syntheses using Laplace Transform:
clear all
clc
t=0:1:5
s=(t);
subplot(2,3,1)
plot(t,s);
u=ones(1,6)
subplot(2,3,2)
plot(t,u);
f1=t.*u;
subplot(2,3,3)
plot(f1);
s2=-2*(t-1);
subplot(2,3,4);
plot(s2);
u1=[0 1 1 1 1 1];
f2=-2*(t-1).*u1;
subplot(2,3,5);
plot(f2);
u2=[0 0 1 1 1 1];
f3=(t-2).*u2;
subplot(2,3,6);
plot(f3);
f=f1+f2+f3;
figure;
plot(t,f);
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
% n=exp(-t);
% n=uint8(n);
% f=uint8(f);
% R = int(f,n,0,6)
laplace(f);
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Conclusion: In this experiment the Triangular signal synthesised using Laplece Trnasforms using
MATLAB
Applications of laplace transforms:
1. Derive the circuit (differential) equations in the time domain, then transform these ODEs to the s-
domain;
2. Transform the circuit to the s-domain, then derive the circuit equations in the s-domain (using the
concept of "impedance").
The main idea behind the Laplace Transformation is that we can solve an equation (or system of equations)
containing differential and integral terms by transforming the equation in "t-space" to one in "s-space". This
makes the problem much easier to solve
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
EXP.NO: 12 Date:
LOCATING THE ZEROS AND POLES AND PLOTTING THE POLE ZERO MAPS IN S-PLANE
AND Z-PLANE FOR THE GIVEN TRANSFER FUNCTION.
Aim: To locating the zeros and poles and plotting the pole zero maps in s-plane and z-plane for the given
transfer function
Equipments:
PC with windows (95/98/XP/NT/2000).
MATLAB Software
Z-transforms
the Z-transform converts a discrete time-domain signal, which is a sequence of real or complex numbers,
into a complex frequency-domain representation.The Z-transform, like many other integral transforms, can
be defined as either a one-sided or two-sided transform.
Bilateral Z-transform
The bilateral or two-sided Z-transform of a discrete-time signal x[n] is the function X(z) defined as
Unilateral Z-transform
Alternatively, in cases where x[n] is defined only for n ≥ 0, the single-sided or unilateral Z-transform is
defined as
In signal processing, this definition is used when the signal is causal.
The roots of the equation P(z) = 0 correspond to the 'zeros' of X(z)
The roots of the equation Q(z) = 0 correspond to the 'poles' of X(z)
The ROC of the Z-transform depends on the convergence of the
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
clc;
close all
clear all;
%b= input('enter the numarator cofficients')
%a= input('enter the denumi cofficients')
b=[1 2 3 4]
a=[1 2 1 1 ]
zplane(b,a);
Applications :Z-Transform is used to find the system responses
Conclusion: In this experiment the zeros and poles and plotting the pole zero maps in s-plane and z-plane for
the given transfer function using MATLAB.
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
EXP.NO: 13 Date:
GAUSSIAN NOISE
%Estimation of Gaussian density and Distribution Functions
% Closing and Clearing all
clc;
clear all;
close all;
% Defining the range for the Random variable
dx=0.01; %delta x
x=-3:dx:3;
[m,n]=size(x);
% Defining the parameters of the pdf
mu_x=0; % mu_x=input('Enter the value of mean');
sig_x=0.1; % sig_x=input('Enter the value of varience');
% Computing the probability density function
px1=[];
a=1/(sqrt(2*pi)*sig_x);
for j=1:n
px1(j)=a*exp([-((x(j)-mu_x)/sig_x)^2]/2);
end
% Computing the cumulative distribution function
cum_Px(1)=0;
for j=2:n
cum_Px(j)=cum_Px(j-1)+dx*px1(j);
end
% Plotting the results
figure(1)
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
plot(x,px1);grid
axis([-3 3 0 1]);
title(['Gaussian pdf for mu_x=0 and sigma_x=', num2str(sig_x)]);
xlabel('--> x')
ylabel('--> pdf')
figure(2)
plot(x,cum_Px);grid
axis([-3 3 0 1]);
title(['Gaussian Probability Distribution Function for mu_x=0 and sigma_x=', num2str(sig_x)]);
title('\ite^\omega\tau = cos(\omega\tau) + isin(\omega\tau)')
xlabel('--> x')
ylabel('--> PDF')
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
EXP.NO: 14 Date:
14. SAMPLING THEOREM VERIFICATION
Aim: To detect the edge for single observed image using sobel edge detection and canny edge detection.
Equipments: PC with windows (95/98/XP/NT/2000).
MATLAB Software
Theory:
Sampling Theorem:
A band limited signal can be reconstructed exactly if it is sampled at a rate atleast twice the maximum
frequency component in it." Figure 1 shows a signal g(t) that is bandlimited.
Figure 1: Spectrum of bandlimited signal g(t)
The maximum frequency component of g(t) is fm. To recover the signal g(t) exactly from its samples it has
to be sampled at a rate fs ≥ 2fm. The minimum required sampling rate fs = 2fm is called ' Nyquist rate
Proof: Let g(t) be a bandlimited signal whose bandwidth is fm (wm = 2πfm).
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Figure 2: (a) Original signal g(t) (b) Spectrum G(w) δ (t) is the sampling signal with fs = 1/T > 2fm.
Figure 3: (a) sampling signal δ (t) ) (b) Spectrum δ (w)
Let gs(t) be the sampled signal. Its Fourier Transform Gs(w) isgiven by
Figure 4: (a) sampled signal gs(t) (b) Spectrum Gs(w)
To recover the original signal G(w):
1. Filter with a Gate function, H2wm(w) of width 2wm
Scale it by T.
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Figure 5: Recovery of signal by filtering with a fiter of width 2wm
Aliasing is a phenomenon where the high frequency components of the sampled signal interfere with each
other because of inadequate sampling ws < 2wm.
Figure 6: Aliasing due to inadequate sampling
Aliasing leads to distortion in recovered signal. This is the reason why sampling frequency should be atleast
twice the bandwidth of the signal.
Oversampling: In practice signal are oversampled, where fs is sampling frequency higher than Nyquist rate to
avoid aliasing.
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Figure 7: Oversampled signal-avoids aliasing
t=-10:.01:10;
T=4;
fm=1/T;
x=cos(2*pi*fm*t);
subplot(2,2,1);
plot(t,x);
xlabel('time');ylabel('x(t)')
title('continous time signal')
grid;
n1=-4:1:4
fs1=1.6*fm;
fs2=2*fm;
fs3=8*fm;
x1=cos(2*pi*fm/fs1*n1);
subplot(2,2,2);
stem(n1,x1);
xlabel('time');ylabel('x(n)')
title('discrete time signal with fs<2fm')
hold on
subplot(2,2,2);
plot(n1,x1)
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
grid;
n2=-5:1:5;
x2=cos(2*pi*fm/fs2*n2);
subplot(2,2,3);
stem(n2,x2);
xlabel('time');ylabel('x(n)')
title('discrete time signal with fs=2fm')
hold on
subplot(2,2,3);
plot(n2,x2)
grid;
n3=-20:1:20;
x3=cos(2*pi*fm/fs3*n3);
subplot(2,2,4);
stem(n3,x3);
xlabel('time');ylabel('x(n)')
title('discrete time signal with fs>2fm')
hold on
subplot(2,2,4);
plot(n3,x3)
grid;
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Conclusion: In this experiment the sampling theorem have been verified using MATLAB
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
EXP.No:15 Date:
REMOVAL OF NOISE BY AUTO CORRELATION/CROSS CORRELATION
Aim: removal of noise by auto correlation/cross correlation
Equipments: PC with windows (95/98/XP/NT/2000).
MATLAB Software
Theory:
Detection of a periodic signal masked by random noise is of greate importance .The noise signal
encountered in practice is a signal with random amplitude variations. A signal is uncorrelated with any
periodic signal. If s(t) is a periodic signal and n(t) is a noise signal then
T/2
Lim 1/T ∫ S(t)n(t-T) dt=0 for all T
T--∞ -T/2
Qsn(T)= cross correlation function of s(t) and n(t) Then Qsn(T)=0
Detection by Auto-Correlation:
S(t)=Periodic Signal mixed with a noise signal n(t).Then f(t) is [s(t ) + n(t) ]
Let Qff(T) =Auto Correlation Function of f(t)
Qss(t) = Auto Correlation Function of S(t)
Qnn(T) = Auto Correlation Function of n(t)
T/2
Qff(T)= Lim 1/T ∫ f(t)f(t-T) dt
T--∞ -T/2
T/2
= Lim 1/T ∫ [s(t)+n(t)][s(t-T)+n(t-T)] dt
T--∞ -T/2
=Qss(T)+Qnn(T)+Qsn(T)+Qns(T)
The periodic signal s(t) and noise signal n(t) are uncorrelated
Qsn(t)=Qns(t)=0 ;Then Qff(t)=Qss(t)+Qnn(t)
The Auto correlation function of a periodic signal is periodic of the same frequency and the Auto correlation
function of a non periodic signal is tends to zero for large value of T since s(t) is a periodic signal and n(t) is
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
non periodic signal so Qss(T) is a periodic where as aQnn(T) becomes small for large values of T Therefore
for sufficiently large values of T Qff(T) is equal to Qss(T).
Detection by Cross Correlation:
f(t)=s(t)+n(t)
c(t)=Locally generated signal with same frequencyas that of S(t)
T/2
Qfc (t) = Lim 1/T ∫ [s(t)+n(t)] [ c(t-T)] dt
T--∞ -T/2
= Qsc(T)+Qnc(T)
C(t) is periodic function and uncorrelated with the random noise signal n(t). Hence Qnc(T0=0) Therefore
Qfc(T)=Qsc(T)
a)auto correlation
clear all
clc
t=0:0.1:pi*4;
s=sin(t);
k=2;
subplot(6,1,1)
plot(s);
title('signal s');
xlabel('t');
ylabel('amplitude');
n = randn([1 126]);
f=s+n;
subplot(6,1,2)
plot(f);
title('signal f=s+n');
xlabel('t');
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
ylabel('amplitude');
as=xcorr(s,s);
subplot(6,1,3)
plot(as);
title('auto correlation of s');
xlabel('t');
ylabel('amplitude');
an=xcorr(n,n);
subplot(6,1,4)
plot(an);
title('auto correlation of n');
xlabel('t');
ylabel('amplitude');
cff=xcorr(f,f);
subplot(6,1,5)
plot(cff);
title('auto correlation of f');
xlabel('t');
ylabel('amplitude');
hh=as+an;
subplot(6,1,6)
plot(hh);
title('addition of as+an');
xlabel('t');
ylabel('amplitude');
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
b) Cross Correlation:
clear all
clc
t=0:0.1:pi*4;
s=sin(t);
k=2;
%sk=sin(t+k);
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
subplot(7,1,1)
plot(s);
title('signal s');xlabel('t');ylabel('amplitude');
c=cos(t);
subplot(7,1,2)
plot(c);
title('signal c');xlabel('t');ylabel('amplitude');
n = randn([1 126]);
f=s+n;
subplot(7,1,3)
plot(f);
title('signal f=s+n');xlabel('t');ylabel('amplitude');
asc=xcorr(s,c);
subplot(7,1,4)
plot(asc);
title('auto correlation of s and c');xlabel('t');ylabel('amplitude');
anc=xcorr(n,c);
subplot(7,1,5)
plot(anc);
title('auto correlation of n and c');xlabel('t');ylabel('amplitude');
cfc=xcorr(f,c);
subplot(7,1,6)
plot(cfc);
title('auto correlation of f and c');xlabel('t');ylabel('amplitude');
hh=asc+anc;
subplot(7,1,7)
plot(hh);
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
title('addition of asc+anc');xlabel('t');ylabel('amplitude');
Conclusion: In this experiment the removal of noise by auto correlation/cross correlation have been verified
using MATLAB
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
EXP.No:16 Date:
EXTRACTION OF PERIODIC SIGNAL MASKED BY NOISE USING CORRELATION
Extraction of Periodic Signal Masked By Noise Using Correlation
clear all;
close all;
clc;
n=256;
k1=0:n-1;
x=cos(32*pi*k1/n)+sin(48*pi*k1/n);
plot(k1,x)
%Module to find period of input signl
k=2;
xm=zeros(k,1);
ym=zeros(k,1);
hold on
for i=1:k
[xm(i) ym(i)]=ginput(1);
plot(xm(i), ym(i),'r*');
end
period=abs(xm(2)-xm(1));
rounded_p=round(period);
m=rounded_p
% Adding noise and plotting noisy signal
y=x+randn(1,n);
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
figure
plot(k1,y)
% To generate impulse train with the period as that of input signal
d=zeros(1,n);
for i=1:n
if (rem(i-1,m)==0)
d(i)=1;
end
end
% correlating noisy signal and impulse train
cir=cxcorr1(y,d);
%plotting the original and reconstructed signal
m1=0:n/4;
figure
plot(m1,x(m1+1),'r',m1,m*cir(m1+1));
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Applications:
The theorem is useful for analyzing linear time-invariant systems, LTI systems, when the inputs and outputs
are not square integrable, so their Fourier transforms do not exist. A corollary is that the Fourier transform of
the autocorrelation function of the output of an LTI system is equal to the product of the Fourier transform of
the autocorrelation function of the input of the system times the squared magnitude of the Fourier transform
of the system impulse response. This works even when the Fourier transforms of the input and output signals
do not exist because these signals are not square integrable, so the system inputs and outputs cannot be
directly related by the Fourier transform of the impulse response. Since the Fourier transform of the
autocorrelation function of a signal is the power spectrum of the signal, this corollary is equivalent to saying
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
that the power spectrum of the output is equal to the power spectrum of the input times the power transfer
function. This corollary is used in the parametric method for power spectrum estimation.
Conclusion: In this experiment the Weiner-Khinchine Relation has been verified using MATLAB.
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Exp. No:17 Date:
VERIFICATION OF WIENER–KHINCHIN RELATION Aim: Verification of wiener–khinchine relation
Equipments: PC with windows (95/98/XP/NT/2000).
MATLAB Software
Theory:
The Wiener–Khinchin theorem (also known as the Wiener–Khintchine theorem and sometimes as the
Wiener–Khinchin–Einstein theorem or the Khinchin–Kolmogorov theorem) states that the power
spectral density of a wide-sense-stationary random process is the Fourier transform of the corresponding
autocorrelation function.
Continuous case:
Where
is the autocorrelation function defined in terms of statistical expectation, and where is the power spectral
density of the function . Note that the autocorrelation function is defined in terms of the expected value of a
product, and that the Fourier transform of does not exist in general, because stationary random functions are
not square integrable.
The asterisk denotes complex conjugate, and can be omitted if the random process is real-valued.
Discrete case:
Where and where is the power spectral density of the function with
discrete values Being a sampled and discrete-time sequence, the spectral density is periodic in the frequency
domain.
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Program:
clc
clear all;
t=0:0.1:2*pi;
x=sin(2*t);
subplot(3,2,1);
plot(x);
au=xcorr(x,x);
subplot(3,2,2);
plot(au);
v=fft(au);
subplot(3,2,3);
plot(abs(v));
fw=fft(x);
subplot(3,2,4);
plot(fw);
fw2=(abs(fw)).^2;
subplot(3,2,5);
plot(fw2);
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Exp No.18. Date:
CHECKING A RANDOM PROCESS FOR STATIONARITY IN WIDE SENSE.
Aim: Checking a random process for stationarity in wide sense.
Equipments: PC with windows (95/98/XP/NT/2000).
MATLAB Software
Theory: A stationary process (or strict(ly) stationary process or strong(ly) stationary process) is a
stochastic process whose joint probability distribution does not change when shifted in time or space. As a
result, parameters such as the mean and variance, if they exist, also do not change over time or position..
Definition
Formally, let Xt be a stochastic process and let represent the cumulative
distribution function of the joint distribution of Xt at times t1…..tk. Then, Xt is said to be stationary if, for all
k, for all τ, and for all t1…..tk
Weak or wide-sense stationarity
A weaker form of stationarity commonly employed in signal processing is known as weak-sense
stationarity, wide-sense stationarity (WSS) or covariance stationarity. WSS random processes only
require that 1st and 2nd moments do not vary with respect to time. Any strictly stationary process which has
a mean and a covariance is also WSS.
So, a continuous-time random process x(t) which is WSS has the following restrictions on its mean function
and autocorrelation function
The first property implies that the mean function mx(t) must be constant. The second property implies that the
correlation function depends only on the difference between t1 and t2 and only needs to be indexed by one
variable rather than two variables. Thus, instead of writing,
we usually abbreviate the notation and write
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
This also implies that the auto covariance depends only on τ = t1 − t2, since
When processing WSS random signals with linear, time-invariant (LTI) filters, it is helpful to think of the
correlation function as a linear operator. Since it is a circulant operator (depends only on the difference
between the two arguments), its eigenfunctions are the Fourier complex exponentials. Additionally, since the
eigenfunctions of LTI operators are also complex exponentials, LTI processing of WSS random signals is
highly tractable—all computations can be performed in the frequency domain. Thus, the WSS assumption is
widely employed in signal processing algorithms.
Applicatons: Stationarity is used as a tool in time series analysis, where the raw data are often transformed
to become stationary, for example, economic data are often seasonal and/or dependent on the price level.
Processes are described as trend stationary if they are a linear combination of a stationary process and one or
more processes exhibiting a trend. Transforming these data to leave a stationary data set for analysis is
referred to as de-trending
Stationary and Non Stationary Random Process:
A random X(t) is stationary if its statistical properties are unchanged by a time shift in the time origin.When
the auto-Correlation function Rx(t,t+T) of the random X(t) varies with time difference T and the mean value
of the random variable X(t1) is independent of the choice of t1,then X(t) is said to be stationary in the wide-
sense or wide-sense stationary . So a continous- Time random process X(t) which is WSS has the following
properties
1) E[X(t)]=µX(t)= µX(t+T)
2) The Autocorrelation function is written as a function of T that is
3) RX(t, t+T)=Rx(T)
If the statistical properties like mean value or moments depends on time then the random process is said
to be non-stationary.
When dealing with two random process X(t) and Y(t), we say that they are jointly wide-sense stationary
if each process is stationary in the wide-sense.
Rxy(t,t+T)=E[X(t)Y(t+T)]=Rxy(T).
Matlab Program:
clear all
clc
y = randn([1 40])
my=round(mean(y));
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
z=randn([1 40])
mz=round(mean(z));
vy=round(var(y));
vz=round(var(z));
t = sym('t','real');
h0=3;
x=y.*sin(h0*t)+z.*cos(h0*t);
mx=round(mean(x));
k=2;
xk=y.*sin(h0*(t+k))+z.*cos(h0*(t+k));
x1=sin(h0*t)*sin(h0*(t+k));
x2=cos(h0*t)*cos(h0*(t+k));
c=vy*x1+vz*x1;
%if we solve "c=2*sin(3*t)*sin(3*t+6)" we get c=2cos(6)
%which is a costant does not depent on variable 't'
% so it is wide sence stationary
Viva-voice:
1. Define Signal
2. Define deterministic and Random Signal
3. Define Delta Function
4. What is Signal Modeling
5. Define Periodic and a periodic Signal
6. Define Symmetric and Anti-Symmetric Signals
7. Define Continuous and Discrete Time Signals
8. What are the Different types of representation of discrete time signals
9. What are the Different types of Operation performed on signals
10. What is System
11. What is Causal Signal
12. What are the Different types of Systems
13. What is Linear System
14. What is Signum function?
15. What is Static and Dynamic System
16. What is Even Signal
17. What is Odd Signal
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
18. Define the Properties of Impulse Signal
19. What is Causality Condition of the Signal
20. What is Condition for System Stability
21. Define Convolution
22. Define Properties of Convolution
23. What is the Sufficient condition for the existence of F.T
24. Define the F.T of a signal
25. State Paeseval’s energy theorem for a periodic signal
26. Define sampling Theorem
27. What is Aliasing Effect
28. what is Under sampling
29. What is Over sampling
30. Define Correlation
31. Define Auto-Correlation
32. Define Cross-Correlation
33. Define Convolution
34. Define Properties of Convolution
35. What is the Difference Between Convolution& Correlation
36. What are Dirchlet Condition
37. Define Fourier Series
38. What is Half Wave Symmetry
39. What are the properties of Continuous-Time Fourier Series
40. Define Laplace-Transform
41. What is the Condition for Convergence of the L.T
42. What is the Region of Convergence(ROC)
43. State the Shifting property of L.T
44. State convolution Property of L.T
45. Define Transfer Function
46. Define Pole-Zeros of the Transfer Function
47. What is the Relationship between L.T & F.T &Z.T
48. Fined the Z.T of a Impulse and step
49. What are the Different Methods of evaluating inverse z-T
50. Explain Time-Shifting property of a Z.T
51. what are the ROC properties of a Z.T
52. Define Initial Value Theorem of a Z.T
53. Define Final Value Theorem of a Z.T
54. Define Sampling Theorem
55. Define Nyquist Rate
56. Define Energy of a Signal
57. Define Power of a signal
58. Define Gibbs Phenomena
59. Define the condition for distortionless transmission through the system
60. What is signal band width
61. What is system band width
62. What is Paley-Winer criterion?
63. Derive relationship between rise time and band width.
64. State the relation ship between PSD and ACF?
65. What is the integration of ramp signal?
66. Difference between vectors and signals?
67. What is the important of dot product over cross product in signals?
68. Define Hilbert transform?
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
69. Relation ship between FT and ZT?
70. What are the different properties of signals?
71. What are the different properties of systems?
72. what LTI system?
73. What is time variant and time in variant with examples?
74. Define inevitability?
75. Define stable and un stable?
76. what is the condition for WSS random process?
77. Define random variable with examples?
78. Define random process with examples?
79. Difference between ACF and CCF?
80. what are the different noises?
LAB PRACTICE QUESTIONS
Write and simulate a Matlab function to generate a Unit parabola
Write and simulate a Matlab function to generate a Unit cubic
Write and simulate a Matlab for triangle wave, sine wave of 3vpp and frequency 1000hz
Generate Matlab program to exp(-t)cos(2*pi*4*t)
Generate Matlab program to t*(cos2*pi*4*t)
Generate Matlab program to t *exp(-t)
Generate Matlab program to step function
Generate a Exponential sequence multiplied with ‘cos’ function
Generate a sin function output with exponential sequences.
Program to plot u(t-4), u(t+4),δ(t+5), δ(t+6),π((t-1)/2),u(-t+3),u(2t+4)
Create the function x=y(t) such that
y(t)=t+5; -5<t<-2;
11+4t; -2<t<1;
24-19t; 1<t<3
t-6; 3<t<6
hence plot y(t), y(t+4), 2y(t-3), y(2t), y(2t-3), y(t/2).
Genarate the following using MATLAB
x(t)= u(-t+1)
x(t)=3r(t-1)
x(t)=U(n+2-u(n-3)
x(n)=x1(n)+x2(n)where x1(n)=1,3,2,1,x2(n)=1,-2,3,2
x(t)=r(t)-2r(t-1)+r(t-2)
x(n)=2δ(n+2)-2δ(n-4), -5≤ n ≥5.
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Calculate the following signals energies
i. x(t)=u(t)-u(t-15)
ii .cos(10∏t)u(t)u(2-t-5)
Calculate the following signals energies
d. x(t)= e
j(2t+∏/4)
e. x(t)=cos(t)
f. x(t)=cos(∏/4) n
Write a program to accept a finite duration causal sequence x[n] and plot the sequence and it’s odd and
even parts.
Find the even and odd parts of the signal x(t)=sint+cost+sintcost and plot the individual signal using
MATLAB
Write a Mat lab program to convolve the signals x(t) = π[(t-1)/2] and h(t) = e-0.5t
u(t) plot the two signals
x(t) and h(t) along with the result of the convolution, y(t).
Write a Mat lab program using the conv function to obtain the Hilbert transforms of the Following signals
a) A Square pulse; b) A Triangle;
Simulate a matlab program on autocorrelation and PSD if x = [1 2 3 4 5 ]
Simulate a matlab program on autocorrelation and PSD if x = [1 1 0 1 ]
x (n)=[1 -1 4 ], h(n) = [ -1 2 -3 1] find y(n), where x(n) is input, h(n) is impulse response, and y(n) is the
output of the system.
Perform convolution between the. Two periodic sequences
x1(t)=e-3t
u(t)-u(t-2) , x2(t)= e -3t
for 0 ≤ t ≤ 2
x(n)=[1 -1 4 ], h(n) = [ -1 2 -3 1] find y(n) where x(n) is input, h(n) is impulse response, and y(n) is the
output of the system.
Check the linearity property of the systems y(t)=2x(t)+3 and y(t)=x2(t)
Check the stability of the systems y(t)= t e-at
u(t) and y(t)=t eatu(t)
Check the time invariant property of the systems y(t)=tx(t) and y(t)= x(4t)
Let the impulse response of an LTI system be given by h(t)=u(t-1)-u(t-4) find output of system if input
x(t)=u(t)+u(t-1)-2u(t-2)
Write and simulate a program on impulse response if y(n) = x(n) + x(n-1) + x(n-2)
Write and simulate a program on unit step sequence if y(n) = u(n) + (n-2) + u(n-4)
Write and simulate a program on impulse response if y(t)= cos(t) + sin(t)
Write and simulate an impulse response of y(n) = 2x(n -1) – 2x(n – 2) + 4y(n – 1)
Write and simulate an impulse response of y(n) = x(n) – x(n -1) – x(n-2)
Basic Simulation Lab
Department of Electronics and Communication Engineering, TITS, Hyderabad
Write a program for fourier transform of periodic signal
Write a program of FT of cos(t)
x(t)= 3e-tu(t) be the input to a system with impulse response h(t)= 2 e
-2tu(t) find y(t) and its fourier transform.
Given the following polynomials in S, find the inverse Laplace transforms, y1 (t), y2 (t), y3 (t), and y4 (t). in
Symbolic Mat lab Dirac(n,t) denotes the nth derivative of the unit impulse Function. X1(s) = s3 + 6s2 +11s
+6, X2(s) = [s2 + 4]2 and X3(s) = s2 + 4s + 4
a) Y1(s) = X1(s)/ X2(s), b) Y2(s) = X1(s)/ X3(s), c) Y3(s) =1/ X1(s) X2(s).
Use the MATLAB command pzpole to plot the poles and zeros of
H(s)= (s3+1)/(s
4+2s
2+1)
Find the laplace transform of delta function, unit function, ramp function, shifted unit function, shifted unit,
shifted ramp functions,
Find the Laplace transform of ‘sinwt’ and ‘coswt’
Find the inverse laplace transform of F=24/(s*(s+8));
Use the MATLAB command roots to determine the poles and zeros of the system
H(s)=(s2+2)/(s
3++2s
2-s+1)
H(s)=(s3+1)/(s
4++2s
2+1)
Sketch the magnitude response of the LTI system having transfer function
H(s)=(s-0.5)/((s+0.1-5j)(s+0.1+5j))
Write a program to simulate parseval’s relation