Beruflich Dokumente
Kultur Dokumente
PREPARED BY:
VERIFIED BY:
LIST OF EXPERIMENTS
S.No
EXP.NO: 1
Aim: To generate matrix and perform basic operation on matrices Using MATLAB
Software.
EQUIPMENTS:
PC with windows (95/98/XP/NT/2000).
MATLAB Software
CONCLUSION:
EXP.NO: 2
GENERATION OF VARIOUS SIGNALS AND SEQUENCES (PERIODIC AND
APERIODIC), SUCH AS UNIT IMPULSE, UNIT STEP,
SQUARE, SAWTOOTH,
TRIANGULAR, SINUSOIDAL, RAMP, SINC.
Matlab program:
%unit impulse generation clc
close all n1=-3;
n2=4; n0=0;
n=[n1:n2];
x=[(n-n0)==0]
stem(n,x)
[y,n]=stepseq(n0,n1,n2);
stem(n,y); xlabel('n') ylabel('amplitude'); title('unit step');
% 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');
ylabel('amplitude');
title ('ramp')
% sinc
CONCLUSION:
EXP.NO: 3
%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
1. x(t)= u(-t+1)
2. x(t)=3r(t-1)
3.
4.
5.
6.
7.
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)
EXP.NO: 4
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
%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;
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=hx1; 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');
% 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
% 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:
EXP.NO: 5
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
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);
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
CONCLUSION:
EXP.NO: 6
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');
EXP.NO: 7
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;
d=y-yt; d=round(d) if d
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
Program
clc;
close all;
clear all;
xlabel(' n----->');ylabel('Amplitude--->');
title('input seq');
subplot(3,1,2);
N=length(y); n=0:1:N1; 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;
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;
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;
CONCLUSION:
EXP.NO:8
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 Realizability And Stability Properties.
EQUIPMENTS:
PC with windows (95/98/XP/NT/2000).
MATLAB Software
CONCLUSION: I
EXP.NO: 9
GIBBS
PHENOMENON
EXP.NO: 10.
MATLAB Software
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]------>');
Exp:11
LAPLACE TRNASFORMS
EXP.NO: 12
LOCATING THE ZEROS AND POLES AND PLOTTING THE POLE ZERO MAPS IN SPLANE 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
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);
Result: :
EXP.NO: 13
13. Gaussian noise
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) 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')
EXP.NO: 14
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
Aliasing
{ Aliasing is a phenomenon where the high frequency components of the sampled
signal interfere with each other because of inadequate sampling ws < 2wm.
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;
EXP.No:15
EQUIPMENTS:
PC with windows (95/98/XP/NT/2000).
MATLAB Software
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);
B)CROSS CORRELATION :
clear all clc
t=0:0.1:pi*4;
s=sin(t);
k=2;
%sk=sin(t+k);
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
Result:
EXP.No:16
EXTRACTION OF PERIODIC SIGNAL MASKED BY NOISE USING CORRELATION
Extraction of Periodic Signal Masked By Noise Using Correlation
Program:
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);
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));
EXP.No:17
VERIFICATION OF WIENERKHINCHIN RELATION
Result:
EXP18.
CHECKING A RANDOM PROCESS FOR STATIONARITY IN WIDE SENSE.
Result: