Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Verification of DFT Properties

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Verification of DFT properties

1: Verification of Frequency shift property


clc;
clear all;
close all;
a=input('Enter the sequence as a row matrix'); % enter the sequence
l=input('Enter the delay in samples'); % Delay to be less than length of the sequenc
N=length(a);
afft=fft(a,N);
concatseq=[afft,afft,afft];
delseq=concatseq(l+1:N+l);
k=0:N-1;
adfft=exp(1i*2*(N-l)*pi/N*k).*a;
ad=fft(adfft);
if (round(ad)==round(delseq))
disp('Frequncy shift property verified');
end

Frequncy shift property verified

Inference:

Frequncy shift property verified

2: Verification of Time shift property


clc;
clear all;
close all;
a=input('Enter the sequence as a row matrix'); % enter the sequence
l=input('Enter the delay in samples'); % Delay to be less than length of the sequence
N=length(a);
concatseq=[a,a,a];
delseq=concatseq(l+1:N+l);
afft=fft(a,N);
k=0:N-1;
adfft=exp(-1i*2*(N-l)*pi/N*k).*afft;
ad=ifft(adfft);
if (round(ad)==(delseq))
disp('Time shift property verified');
end

Time shift property verified

Inference:

1
Time shift property verified

3: Verification of Linearity property and Parseval


clc;
clear all;
close all;

Linearity Property
x1=input('Enter Sequence 1 : ');
x2=input('Enter Sequence 2 of same length as x1 : '); % Enter same length sequences
a1=input('Enter a1 = ');
a2=input('Enter a2 = ');
x1f=fft(x1);
x2f=fft(x2);
x3f= a1*x1f+a2*x2f;
x3= a1*fft(x1)+a2*fft(x2);
if (round(x3)==round(x3f))
disp('Linearity property verified');
end

Linearity property verified

Parsevals Identity
x1=x1(:);
x1f=x1f(:);
N=length(x1f);
Entime=x1'*x1;
Enfreq=(x1f'*x1f)/N;
if (round(Entime)==round(Enfreq))
disp('Parseval Identity verified');
end

Parseval Identity verified

Inference:

Linearity property and parseval identity verified

4: Verification of Auto correlation & Cross correlation

Correlation:

2
Correlation determines the degree of similarity between two signals. If the signals are identical, then the
correlation coefficient is 1; if they are totally different, the correlation coefficient is 0, and if they are identical
except that the phase is shifted by exactly 1800(i.e. mirrored), then the correlation coefficient is -1.

Autocorrelation:

The Autocorrelation of a sequence is correlation of a sequence with itself.

To compute autocorrelation of a given sequence


close all;
clear all;
clc;
x = input('Enter the input sequence:'); % Get the input sequence
[Rxx,lag] = xcorr(x); % Returns auto-correlated sequence
disp('Auto correlated sequence, Rxx:');

Auto correlated sequence, Rxx:

disp(Rxx);

16.0000 44.0000 80.0000 120.0000 80.0000 44.0000 16.0000

Plots of result on figure window


stem(lag,Rxx);
xlabel('Time');
ylabel('Magnitude');
title('Auto-correlation of the given sequence:');

3
Cross correlation

To compute cross correlation using 'xcorr' commandxcorr’ command


clc;
close all;
clear all;
x = input ('Enter the first sequence =');
y = input ('Enter the second sequence =');

Compute the correlation sequence


n1 = length(y)-1;
n2 = length(x)-1;
[Rxy,lag] = xcorr(x,y);
disp('Cross correlation output is =');

Cross correlation output is =

disp(Rxy);

Columns 1 through 10

0 0.0000 2.0000 2.0000 -7.0000 15.0000 -1.0000 3.0000 16.0000 -2.0000

Columns 11 through 15

4
15.0000 13.0000 13.0000 5.0000 6.0000

N=max(n1,n2) ;

Plots of result on figure window


stem(lag, Rxy);
xlabel('Lag index');
ylabel('Amplitude');

Inference:

Autocorrelation and crosscorrelation is verified

You might also like