필터 지우기
필터 지우기

data isolation from spectogram

조회 수: 12 (최근 30일)
Micah
Micah 2022년 10월 16일
답변: AH 2022년 10월 19일
I have a spectogram (from an audio file) from which i want to isolate/extract the line with the highest power, most intense color. how can i do this?
the code for the spectogram is as follows.
[A,Freq]=audioread(['bmw s100rr 0-300.mp3']);
NFFT=6000;
spectrogram(A,NFFT,NFFT/2,NFFT,Freq,'yaxis');colormap('jet');
ylim([0 1.8])
the acomponying spectogram can be seen below.
how can I isolate the dark red/black line and gather/isolate its values/plot it in a different graph.

답변 (1개)

AH
AH 2022년 10월 19일
The function tfridge can be found helpful here. Below is an example showing how to extract the ridge from the spectrogram.
%% Signal model
fs = 3.6e3; % sampling rate in Hz
t0 = 2; % signal duration in seconds
t = (0:1/fs:t0)'; % time samples
x = vco(sawtooth(2*pi*t,0.5),[0.1 0.4]*fs,fs);
%% Spectrogram
NFFT = 256; % number of FFT points
[S,F,T] = spectrogram(x,NFFT,NFFT/2,NFFT,fs,'yaxis');
spectrogram(x,NFFT,NFFT/2,NFFT,fs,'yaxis')
%% Extract ridge (highest power)
[fridge,~,lridge] = tfridge(S,F);
ridge = S(lridge);
%% Figure
figure
spectrogram(x,NFFT,NFFT/2,NFFT,fs,'yaxis')
hold on
plot3(T,fridge/1e3,abs(ridge),'k','LineWidth',2)
For more complicated time-frequency maps, the input penalty in the tfridge should be tuned. Further information can be found in the documentation page (link to Documentation page). Another useful function/GUI is rpmtrack (link) where points on the ridge with the highest power can be inserted manually to further help ridge extraction.
In addition, it would be great if the audio file could be shared.

카테고리

Help CenterFile Exchange에서 Spectral Measurements에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by