0% found this document useful (0 votes)
53 views

% Rectangular Single Pulse

This document contains 3 parts that discuss signal processing techniques. Part 1 generates and plots triangular and rectangular pulse signals. Part 2 performs cross correlation on input sequences and impulse sequences. It displays the input, impulse, and correlation signals. Part 3 generates delayed rectangular pulse signals, performs cross correlation between a reference signal and the delayed pulses, and plots the correlation results. It then adds white Gaussian noise to the correlation signals and displays the noisy correlations.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views

% Rectangular Single Pulse

This document contains 3 parts that discuss signal processing techniques. Part 1 generates and plots triangular and rectangular pulse signals. Part 2 performs cross correlation on input sequences and impulse sequences. It displays the input, impulse, and correlation signals. Part 3 generates delayed rectangular pulse signals, performs cross correlation between a reference signal and the delayed pulses, and plots the correlation results. It then adds white Gaussian noise to the correlation signals and displays the noisy correlations.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Part 1:

width =10000;
tinc = 1/width;
tend = 1;
range = -1:tinc:tend;
pulse1 = tripuls(range,20e-3);
pulse2 = rectpuls(range,20e-3);
% rectangular single pulse
subplot(211),plot(range,pulse2), axis([-0.1 0.1 -0.2 1.2])
xlabel('Time (sec)');ylabel('Amplitude'); title('Rectangular Pulse')

%triangular single pulse


subplot(212),plot(range,pulse1), axis([-0.1 0.1 -0.2 1.2])
xlabel('Time (sec)');ylabel('Amplitude'); title('Triangular Pulse')

Part 2:
% Cross Correlation
clc;
close all;
clear all;
X=input('enter input sequence');
im=input('enter the impulse suquence');
subplot(3,1,1);
stem(X);
xlabel('n');
ylabel('X(n)');
title('input signal');
subplot(3,1,2);
stem(im);
xlabel('n');
ylabel('h(n)');
title('impulse signal');

Yx=xcorr(X,im);
subplot(3,1,3);
stem(Yx);
xlabel('n');
ylabel('Yx(n)');
disp('the resultant signal is');
disp(Yx);
title('correlation signal');

enter input sequence 2


enter the impulse sequence 2
the resultant signal is
0
0
4
0
0
% auto correlation
clc;
close all;
clear all;
Xx = [1,2,3,4,5,6]; Yy = [4,1,5,2,3,6];
subplot(3,1,1);
stem(Xx);
title('input signal');
subplot(3,1,2);
stem(Yy);
title('input signal');
Zz=xcorr(Xx,Xx);
subplot(3,1,3);
stem(Zz);
title('resultant signal signal');

Part 3:
clc;
tI =0:0.01:5;
T=0.1;
ya2=1*rectpuls(t-T/2-0,T);
ya1=1*rectpuls(tI-T/2-DelayDifferenceBC,T);
ya0=1*rectpuls(tI-T/2-DelayDifferenceAC,T);
figure(1)
subplot(311);plot(t,ya2);
subplot(312);plot(t,ya1);
subplot(313);plot(t,ya0);

YREF=ya2;
rcREF=xcorr(YREF,ya2);
rbREF=xcorr(YREF,ya1);
raREF=xcorr(YREF,ya0);
figure(2)
subplot(311);plot(rcREF);
subplot(312);plot(rbREF);
subplot(313);plot(raREF);

rc=find(rcREF==max(rcREF));
rb=find(rbREF==max(rbREF));
ra=find(raREF==max(raREF));
rc;
rb;
ra;
rc = 432
rb = 392
ra = 352
[DelayDifferenceABreceiver]=ginput(2);
edit DelayDifferenceABreceiver
[4.508506616257089e+02,0.017241379310342;4.689981096408316e+02,0.034722222222226]
[DelayDifferenceACreceiver]=ginput(2);
edit DelayDifferenceACreceiver
[4.497164461247637e+02,0.017241379310342;4.905482041587900e+02,0.034722222222224]
dc= awgn(rcREF,0);
db= awgn(rbREF,0);
da= awgn(raREF,0);
figure(3)
subplot(311);plot(dc);
subplot(312);plot(db);
subplot(313);plot(da);

rc = 432
rb = 392
ra = 352
ans =
450.8507 0.0172
468.9981 -0.0347
ans =
449.7164 0.0172
490.5482 -0.0347

You might also like