Average of multiple Thompson Multitaper Power Spectral Density Estimates
3 ビュー (過去 30 日間)
古いコメントを表示
I am doing signal processing of fricative sounds. I have managed to plot the tokens I have on the same plot, but I also want to plot the average spectra, based on the other PSDs . Of course, I would like it if I could also plot the average spectra in a different color! Any help would be appreciated.
The current spectra I have were created using the functions:
Hs = spectrum.mtm;
fs = 44100 %this is the recording quality of the signal;
x = wavread('filename');
y = wavread('otherfilename');
z = wavread('lastfilename');
x1 = psd(Hs, x, 'fs', fs);
y2 = psd(Hs, y, 'fs', fs);
z1 = psd(Hs, z, 'fs', fs);
hold on;
plot(x1);
plot(y1);
plot(z1);
I want to plot the average spectrum on top of those spectrums (in black, if possible)! Again, thank you for any help!
I have attached the .wav files in a .zip folder.
Phil
採用された回答
Image Analyst
2014 年 8 月 2 日
So can't you just take the mean and plot it? I mean
meanSpectrum = (x1+y1+z1)/3;
plot(meanSpectrum, 'k-', 'LineWidth', 3);
legend('x1', 'y1', 'z1', 'meanSpectrum');
It seems really trivial, or am I missing something???
16 件のコメント
Image Analyst
2014 年 8 月 3 日
編集済み: Image Analyst
2014 年 8 月 3 日
This is my code. Originally you were plotting the first 9 as a function of element number, not frequency, and only the mean PSD was vs. frequency, so it was all messed up.
Hs = spectrum.mtm;
fs = 44100 %this is the recording quality of the signal;
w1 = wavread('C:\Users\Mark\Documents\Temporary\sheppard_1.wav');
w2 = wavread('C:\Users\Mark\Documents\Temporary\sheppard_2.wav');
w3 = wavread('C:\Users\Mark\Documents\Temporary\sheppard_3.wav');
w4 = wavread('C:\Users\Mark\Documents\Temporary\sheppard_4.wav');
w5 = wavread('C:\Users\Mark\Documents\Temporary\sheppard_5.wav');
w6 = wavread('C:\Users\Mark\Documents\Temporary\sheppard_6.wav');
w7 = wavread('C:\Users\Mark\Documents\Temporary\sheppard_7.wav');
w8 = wavread('C:\Users\Mark\Documents\Temporary\sheppard_8.wav');
w9 = wavread('C:\Users\Mark\Documents\Temporary\sheppard_9.wav');
psd1 = psd(Hs, w1, 'fs', fs);
psd2 = psd(Hs, w2, 'fs', fs);
psd3 = psd(Hs, w3, 'fs', fs);
psd4 = psd(Hs, w4, 'fs', fs);
psd5 = psd(Hs, w5, 'fs', fs);
psd6 = psd(Hs, w6, 'fs', fs);
psd7 = psd(Hs, w7, 'fs', fs);
psd8 = psd(Hs, w8, 'fs', fs);
psd9 = psd(Hs, w9, 'fs', fs);
hold on;
plot(psd1.Frequencies, psd1.Data, '-', 'Color', rand(1,3), 'LineWidth', 2);
plot(psd2.Frequencies, psd2.Data, '-', 'Color', rand(1,3), 'LineWidth', 2);
plot(psd3.Frequencies, psd3.Data, '-', 'Color', rand(1,3), 'LineWidth', 2);
plot(psd4.Frequencies, psd4.Data, '-', 'Color', rand(1,3), 'LineWidth', 2);
plot(psd5.Frequencies, psd5.Data, '-', 'Color', rand(1,3), 'LineWidth', 2);
plot(psd6.Frequencies, psd6.Data, '-', 'Color', rand(1,3), 'LineWidth', 2);
plot(psd7.Frequencies, psd7.Data, '-', 'Color', rand(1,3), 'LineWidth', 2);
plot(psd8.Frequencies, psd8.Data, '-', 'Color', rand(1,3), 'LineWidth', 2);
plot(psd9.Frequencies, psd9.Data, '-', 'Color', rand(1,3), 'LineWidth', 2);
meanPsd = (psd1.Data + psd2.Data + psd3.Data + psd4.Data + psd5.Data + psd6.Data + psd7.Data + psd8.Data + psd9.Data)/9;
plot(psd1.Frequencies, meanPsd, 'k-', 'LineWidth', 5);
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
grid on;
legend('x', 'y', 'z', 'Mean');
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Spectral Estimation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!