# How to quantify spectrogram comparison

76 visualizzazioni (ultimi 30 giorni)
James il 5 Gen 2017
Risposto: Ignas A. il 19 Nov 2018
Given: Two spectrogram plots (spec1.png and spec2.png attached)
Looking for: A method to quantify the difference between the two spectrograms
Purpose: Fault detection and fault severity classification
Previously tried: Substracting the two spectrograms on a point by point basis using: (See specDifference.png)
[S1,F1,T1,S1] = spectrogram(y1,window, noverlap,2048, Fs, 'yaxis');
[S2,F2,T2,P2] = spectrogram(y2,window, noverlap,2048, Fs, 'yaxis');
surf(T2,F2,abs(abs(S1)-abs(S2)),'edgecolor','none'); axis tight; colormap(hot), view(0,90);
This specDifference.png plot allows differences between spectrograms to be visualized. The objective however is to quantify the difference in order to automate the data collection and analysis.
The rationale for using the spectrogram vs comparing the 2-D FFT or PSD plot and calculating the cross correlation or other metric is because this is a mechanism's open-closing event. Visualizing in 2D potentially hides frequency signatures at specific points in time which may serve as fault indicators. Additionally the goal is to quantitatively differentiate normal condition from varying degrees of degraded condition.
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposte (2)

Zhao Wang il 10 Gen 2017
I understand that you want to quantify the difference between two spectrograms and use this quantitative information in fault diagnosis. With regards to the objective, the difference should be with respect to a range of frequencies. You may want to calculate the average power at a particular frequency based on the power spectral density (PSD) obtained using the "spectrogram" function. In addition, the spectral moments may also help in the fault diagnosis application.
In order to obtain a relationship between the two signals with respect to frequency, you can compute the cross power spectral density using the "cpsd" function, such as
>> cpsd(y1,y2,window, noverlap,2048, Fs);
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

Ignas A. il 19 Nov 2018
Hello James,
First of all there is mistake in your code naming power spectral density as S1 insted of P1:
[S1,F1,T1,S1] = spectrogram(y1,window, noverlap,2048, Fs, 'yaxis'); % You have named PSD as S1 insted of P1 (your style)
[S2,F2,T2,P2] = spectrogram(y2,window, noverlap,2048, Fs, 'yaxis');
Next you should consider ploting results in log scale 10*log10(abs(difference)).
Good luck
Ignas
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Categorie

Scopri di più su Spectral Estimation in Help Center e File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by