Error in plotting the Histogram of Multi-taper estimate
2 views (last 30 days)
Show older comments
Hello, I am trying to plot the histogram of the power estimate obtained using the Multi-taper method. When 1 taper is used the histogram shows the expected exponential distribution ; on increasing the number of tapers it is expected that the distribution should show Gamma distribution (as seen when shape parameter = 2 and scaling parameter = 2.0 ). However the the plot still shows exponential distribution as seen when single taper is used. Following is the code that I have used.
{
Fs = 2000;
T1 = [];
S1 = [];
for i =1: length(timeVals)
if (-0.3000<= timeVals(i)) && (timeVals(i)<= -0.1000 );
T1 = [T1,timeVals(i)];
S1 = [S1,signal(:,i)];
end
end
Ta =(max(T1)) - (min(T1));
f1 = 0:1/Ta :Fs;
C1=S1';
params.Fs = Fs;
params.tapers = [2 3];
params.trialave = 0;
params.pad = 1;
[S,f1] = mtspectrumc(C1, params);
S1 = 10*log10(S/max(S));
semilogy(f1,S1,'k');
grid on;
% xlim([0 50])
xlabel('Frequency [Hz]')
ylabel('Power [dB]')
title ('multi-taper spectrum')
hold on;
T2 = [];
S2 = [];
for j = 1: length(timeVals)
if (0.2000<= timeVals(j)) && (timeVals(j)<= 0.4000 )
T2 = [T2,timeVals(j)];
S2 = [S2,signal(:,j)];
end
end
Tb =(max(T2)) - (min(T2));
f2 = 0:1/Tb :Fs;
C2 = S2';
params.Fs = Fs;
params.tapers = [2 3];
params.trialave = 0;
params.pad = 1;
[W,f2] = mtspectrumc(C2, params);
W1 = 10*log10(W/max(W));
semilogy(f2,W1,'r');
grid on;
% xlim([0 50])
xlabel('Frequency [Hz]')
ylabel('Power [dB]')
title ('multi-taper spectrum')
% for plotting the histogram
figure (3);
H = hist(W(:),100);
plot(H);
xlim ([0 100]);
}
Thank You
0 Comments
Answers (0)
See Also
Categories
Find more on Histograms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!