Академический Документы
Профессиональный Документы
Культура Документы
com
www.jwjobs.net
CONTENTS
S.No
Experiment Name
Page No.
2
7
86
www.jntuworld.com
21
27
32
35
39
46
50
52
57
61
64
67
73
79
84
www.jntuworld.com
www.jwjobs.net
EXP.NO: 1
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
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 =
123
456
789
Here we extract column 2 of the matrix and make a column vector:
col_two=matrix( : , 2)
col_two =
258
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 =
123
456
789
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=
123
456
c= b+a % Add a to each element of b
c=
456
789
Scalar - Matrix Subtraction
a=3;
b=[1, 2, 3;4, 5, 6]
b=
123
456
c = b - a %Subtract a from each element of b
c=
-2 -1 0
123
Scalar - Matrix Multiplication
a=3;
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
b=[1, 2, 3; 4, 5, 6]
b=
123
456
c = a * b % Multiply each element of b by a
c=
369
12 15 18
Scalar - Matrix Division
a=3;
b=[1, 2, 3; 4, 5, 6]
b=
123
456
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
b=a+2
b=
3
A = [1 2 0; 2 5 -1; 4 10 -1]
A=
1
-1
10
-1
10
B = A'
B=
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
-1
-1
C=A*B
C=
5
12
24
12
30
59
24
59 117
25 -10
0 -10
-2
-2
-1
-2
and then illustrate the fact that a matrix times its inverse is the identity matrix.
I = inv(A) * A
I=
1
to obtain eigenvalues
5
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
eig(A)
ans =
3.7321
0.2679
1.0000
as the singular value decomposition.
svd(A)
ans =
12.3171
0.5149
0.1577
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
A.*B
A/B
A./B
A\B
A.\B
A^B,A.^B,A',A.
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
EXP.NO: 2
0 t 0
t = 0
(t ) =
And
(t )dt = 1
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,
0,
n=0
n0
i.e
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
Matlab program:
u (t ) (t )dt = (t )dt
0
1
u (t ) =
0
1,
0,
n0
n< 0
www.jntuworld.com
t > 0
t < 0
www.jntuworld.com
www.jwjobs.net
[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, 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 instaneous. 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
10
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
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 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');
SAW TOOTH:
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.
11
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
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)
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
Triangle wave
A triangle wave is a non-sinusoidal waveform named for its triangular shape.A
bandlimited 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 (4n1)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:
13
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
15
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
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.
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:
16
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
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.
% 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
n=input('enter the length of ramp');
t=0:n;
plot(t);
xlabel('t');
17
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
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
18
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
% sinc
x = linspace(-5,5);
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);
1.x(t)=e-t
2.x(t)= t 2 / 2
19
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
1 t>0
0
t=0
-1
t<0
20
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
EXP.NO: 3
Software.
EQUIPMENTS:
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 Amplification/Attuation :
21
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
folding:
y(n)={x(-n)} ;
y=fliplr(x); n=-fliplr(n);
22
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
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;
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');
23
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
24
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
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');
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
2.
3.
4.
5.
6.
7.
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.
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)
26
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
EXP.NO: 4
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:
27
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
for i=1:9
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');
28
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
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
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
29
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
% power
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
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
exersize questions: find even and odd parts of the following signals
1.x(n)= e(-0.1+j0.3)n ,-
10n10
e j(2t+/4)
x(t)=cos(t)
x(t)=cos(/4 n
30
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
EXP.NO: 5
LINEAR CONVOLUTION
Aim: To find the out put with linear convolution operation Using MATLAB Software.
EQUIPMENTS:
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);
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);
31
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
stem(y);
xlabel('n');ylabel('y(n)');
title('linear convolution')
disp('The resultant signal is');
disp(y)
linear convolution
output:
32
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
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.
Excersize 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
33
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
EXP.NO: 6
Aim: To compute auto correlation and cross correlation between signals and
sequences
EQUIPMENTS:
rx , y (l ) =
x( n) y ( n l )
n =
rx , x (l ) =
x( n) x( n l )
n =
% Cross Correlation
clc;
close all;
clear all;
x=input('enter input sequence');
34
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
35
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
% 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);
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');
36
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
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
Excersize 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
37
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
EXP.NO: 7
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;
yt=a*y1+b*y2;
38
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
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); grid
subplot(3,1,3), stem(n,d); grid
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;
39
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
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); 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;
40
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
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)
Program1:
clc;
close all;
clear all;
n=0:40;
41
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
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
subplot(3,1,1),stem(y),grid;
subplot(3,1,2),stem(yd),grid;
subplot(3,1,3),stem(d),grid;
42
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
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));
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),grid;
subplot(3,1,3),stem(d),grid;
43
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
44
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
EXP.NO:8
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,
45
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
46
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
47
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
48
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
EXP.NO: 9
GIBBS PHENOMENON
Aim: To verify the Gibbs Phenomenon.
EQUIPMENTS:
PC with windows (95/98/XP/NT/2000).
MATLAB Software
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;
end
49
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
50
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
EXP.NO: 10.
PROGRAM:
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
MATLAB Software
Theory:
DFT of a sequence
N 1
X[K] =
K = 0
x [n ]e
j 2 Kn
N
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]------>');
52
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
53
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
grid
xlabel('k')
ylabel('degrees')
Applications:
The no of multiplications in DFT = N2.
The no of Additions in DFT = N(N-1).
For FFT.
The no of multiplication = N/2 log 2N.
The no of additions
= N log2 N.
54
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
CONCLUSION: In this experiment the fourier transform of a given signal and plotting
its magnitude and phase spectrum have been demonstrated using matlab
55
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
Exp:11
LAPLACE TRNASFORMS
Aim: To perform waveform synthesis using Laplece Trnasforms of a given signal
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):
56
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
57
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
58
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
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 sdomain (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
59
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
EXP.NO: 12
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
60
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
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);
61
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
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.
62
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
EXP.NO: 13
63
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
xlabel('--> x')
ylabel('--> PDF')
64
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
65
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
EXP.NO: 14
66
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
67
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
69
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
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;
70
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
71
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
EXP.No:15
EQUIPMENTS:
PC with windows (95/98/XP/NT/2000).
MATLAB Software
for all T
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 non periodic signal so Qss(T) is a periodic where
72
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
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)
Qfc (t)
T/2
= 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');
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);
73
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
74
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
B)CROSS CORRELATION :
clear all
clc
t=0:0.1:pi*4;
s=sin(t);
k=2;
%sk=sin(t+k);
75
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
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);
title('addition of asc+anc');xlabel('t');ylabel('amplitude');
76
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
77
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
EXP.No:16
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
y=x+randn(1,n);
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);
79
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
80
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
Application
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 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.
81
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
82
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
EXP.No:17
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 realvalued.
Discrete case:
Where
83
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
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.
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);
84
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
85
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
EXP18.
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
86
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
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,
= 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 tractableall 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
87
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
MATLAB PROGRAM:
clear all
clc
y = randn([1 40])
my=round(mean(y));
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
88
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
VIVA-VOICE:
1. Define Signal
2. Define determistic and Random Signal
3. Define Delta Function
4. What is Signal Modeling
5. Define Periodic and a periodic Signal
6. Define Symetric 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
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 Paesevals 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
89
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
90
www.jntuworld.com