我非常有興趣知道如何生成右上圖:http://en.wikipedia.org/wiki/Spectrogram (腳本),以及如何分析它,即什麼信息它表達了什麼?我會很感激最簡單的答案,用最少的數學術語。謝謝。頻譜圖和它是什麼
Q
頻譜圖和它是什麼
3
A
回答
3
該圖顯示沿着水平軸的時間以及沿着垂直軸的頻率。像素顏色顯示每個時間每個頻率的強度。
通過獲取信號並將其切分爲小時間段,在每個段上執行傅立葉級數,生成譜圖。
這裏有一些matlab代碼來生成一個。
注意如何直接繪製信號,看起來像垃圾,但繪製譜圖,我們可以清楚地看到分量信號的頻率。
%%%%%%%%
%% setup
%%%%%%%%
%signal length in seconds
signalLength = 60+10*randn();
%100Hz sampling rate
sampleRate = 100;
dt = 1/sampleRate;
%total number of samples, and all time tags
Nsamples = round(sampleRate*signalLength);
time = linspace(0,signalLength,Nsamples);
%%%%%%%%%%%%%%%%%%%%%
%create a test signal
%%%%%%%%%%%%%%%%%%%%%
%function for converting from time to frequency in this test signal
F1 = @(T)0+40*T/signalLength; #frequency increasing with time
M1 = @(T)1-T/signalLength; #amplitude decreasing with time
F2 = @(T)20+10*sin(2*pi()*T/signalLength); #oscilating frequenct over time
M2 = @(T)1/2; #constant low amplitude
%Signal frequency as a function of time
signal1Frequency = F1(time);
signal1Mag = M1(time);
signal2Frequency = F2(time);
signal2Mag = M2(time);
%integrate frequency to get angle
signal1Angle = 2*pi()*dt*cumsum(signal1Frequency);
signal2Angle = 2*pi()*dt*cumsum(signal2Frequency);
%sin of the angle to get the signal value
signal = signal1Mag.*sin(signal1Angle+randn()) + signal2Mag.*sin(signal2Angle+randn());
figure();
plot(time,signal)
%%%%%%%%%%%%%%%%%%%%%%%
%processing starts here
%%%%%%%%%%%%%%%%%%%%%%%
frequencyResolution = 1
%time resolution, binWidth, is inversly proportional to frequency resolution
binWidth = 1/frequencyResolution;
%number of resulting samples per bin
binSize = sampleRate*binWidth;
%number of bins
Nbins = ceil(Nsamples/binSize);
%pad the data with zeros so that it fills Nbins
signal(Nbins*binSize+1)=0;
signal(end) = [];
%reshape the data to binSize by Nbins
signal = reshape(signal,[binSize,Nbins]);
%calculate the fourier transform
fourierResult = fft(signal);
%convert the cos+j*sin, encoded in the complex numbers into magnitude.^2
mags= fourierResult.*conj(fourierResult);
binTimes = linspace(0,signalLength,Nbins);
frequencies = (0:frequencyResolution:binSize*frequencyResolution);
frequencies = frequencies(1:end-1);
%the upper frequencies are just aliasing, you can ignore them in this example.
slice = frequencies<max(frequencies)/2;
%plot the spectrogram
figure();
pcolor(binTimes,frequencies(slice),mags(slice,:));
矩陣fourierResult
的逆傅里葉變換將返回原始信號。
0
只需添加到蘇基的答案,這裏是一個偉大的教程,通過走你,一步一步,閱讀Matlab的譜圖,觸及只夠數學和物理直觀地解釋主要概念:
http://www.caam.rice.edu/~yad1/data/EEG_Rice/Literature/Spectrograms.pdf
相關問題
- 1. 頻譜顯示我什麼
- 2. 頻譜圖C++庫
- 3. 爲什麼偶函數的頻譜只是實數?
- 4. FFT的頻譜圖在Python
- 5. 視頻編碼層:什麼是VCL和它的功能是什麼
- 6. enCapsa - 它是什麼和用於什麼?
- 7. 什麼是clojure.lang.Var.getRawRoot和它爲什麼叫?
- 8. module.exports和...它是指什麼
- 9. 音頻文件頻譜圖,是時間vs幅度還是時間vs頻率?
- 10. 什麼是廚師食譜索引?
- 11. 在象夫譜聚類,什麼應該是在親和基質
- 12. 從麥克風產生頻譜圖
- 13. 波形文件的頻譜圖
- 14. 在python中繪製音頻譜圖
- 15. Javascript中的Shoutcast流頻譜圖
- 16. 頻譜圖使用JavaPlot不工作
- 17. 動態頻譜使用繪圖
- 18. 檢測音頻譜
- 19. 從頻譜畫面
- 20. 時域/頻譜/ DSP
- 21. 繪製音頻譜
- 22. 是什麼山和它的特點是什麼?
- 23. 什麼是MIME?它到底是什麼?
- 24. 他們用什麼課程來繪製這樣的音頻頻譜?
- 25. 它是什麼,安卓:layout_width和layout_height指什麼?它是否包含保證金?
- 26. PTHREAD_MUTEX_INITIALIZER,它是什麼?
- 27. pthread_cleanup_pop_restore - 它是什麼?
- 28. JavaObjectModel。它是什麼?
- 29. MethodHandle - 它是什麼?
- 30. NSComparisonResult和NSComparator - 它們是什麼?
也許DSP.stackexchange更合適... – 2012-01-08 21:52:16
我一直在尋找一個編程解決方案,我不能在dsp中遵循數學術語的技術超載!這就是爲什麼我在這裏問過。謝謝。 – Sm1 2012-01-08 22:03:17
現在的問題不適合dsp.se,所以請不要在那裏重新提問。至於文章中右上角的情節,你可以到[它的頁面瞭解更多詳情](http://en.wikipedia.org/wiki/File:Spectrogram_of_violin.png)。作者使用Adobe Audition創建它,並且使用的音頻文件也可用。您可以使用MATLAB的譜圖文檔中的基本示例來自己做,然後詢問[so],當您遇到您的編程時 – abcd 2012-01-08 22:16:51