DSPRelated.com
Code

PSD Estimation [Blackmann-Tukey Method]-scilab code

Senthilkumar December 28, 2011 Coded in Scilab

This program is used to calculate the power spectrum estimate using Blackmann-tukey method using scilab software

//Caption: PSD Estimation using Blackmann-Tukey Method
// of Given Discrete Sequence 
//x(n) =(0.9)^n, 0<= n<=20
clear;
clc;
close;
N =16; //8-point DFT
n = 0:20;
x1 = (0.9.^n) //given discrete sequence
x = x1([1:16]);
X = dft(x,-1); //16-point DFT of given discrete sequence
Pxx = (1/N)*(abs(X).^2); //Peridogram Estimate 
disp(x,'16 point input discrete sequence x(n)=')
disp(X,'DFT of x(n)is X(k)=')
disp(Pxx,'Peridogram of x(n) is Pxx(k/N)=')
figure(1)
a = gca();
a.data_bounds =[0,0;20,5];
plot2d3('gnn',[1:N],Pxx)
a.foreground = 5; 
a.font_color = 5;
a.font_style = 5;
title('Peridogram Estimate')
xlabel('Discrete Frequency Variable K ----->')
ylabel('Periodogram Pxx (k /N) ---->')
//Result
//16 point input discrete sequence x(n)=   
//column 1 to 9
//1.    0.9    0.81    0.729    0.6561    0.59049    0.531441    0.4782969    0.4304672  
//column 10 to 16
//0.3874205    0.3486784    0.3138106    0.2824295    0.2541866    0.2287679    0.2058911  
//DFT of x(n)is X(k)=   
//    8.1469798               
//    0.9337942 - 1.9085859i  
//    0.5514204 - 0.9651212i  
//    0.4763807 - 0.6042033i  
//    0.4501094 - 0.4050984i  
//    0.4383220 - 0.2710927i  
//    0.4324549 - 0.1681821i  
//    0.4296342 - 0.0807934i  
//    0.4287884 - 1.159D-15i  
//    0.4296342 + 0.0807934i  
//    0.4324549 + 0.1681821i  
//    0.4383220 + 0.2710927i  
//    0.4501094 + 0.4050984i  
//    0.4763807 + 0.6042033i  
//    0.5514204 + 0.9651212i  
//    0.9337942 + 1.9085859i  
// 
//Peridogram of x(n) is Pxx(k/N)=   
//    4.14833    
//    0.2821670  
//    0.0772202  
//    0.0370000  
//    0.0229190  
//    0.0166011  
//    0.0134564  
//    0.0119446  
//    0.0114912  
//    0.0119446  
//    0.0134564  
//    0.0166011  
//    0.0229190  
//    0.0370000  
//    0.0772202  
//    0.2821670