Main Content

Find and Track Ridges Using Reassigned Spectrogram

Load a datafile containing an echolocation pulse emitted by a big brown bat (Eptesicus fuscus) and measured with a sample rate of 7 microseconds. Create a MATLAB® timetable using the signal and the time information.

loadbatsignalt = (0:length(batsignal)-1)*DT; sg = timetable(seconds(t)',batsignal);

OpenSignal Analyzerand drag the timetable from theWorkspace Browserto the Signal table. ClickDisplay Gridto create two side-by-side displays. Select each display and, in theDisplaytab, clickTime-Frequencyto add a spectrogram view.

Drag the timetable to both displays.

Select theSpectrogramtab. For each display:

  • Set the power limits to –45 dB and –20 dB.

  • Specify the time resolution as 280 microseconds and the overlap between adjoining segments as 85%.

  • Use theLeakageslider to increase the leakage until the RBW is about 4.5 kHz.

For the display at right, check重新分配.

The reassigned spectrogram clearly shows three time-frequency ridges. To track the ridges, select the display at right. On theDisplaytab, clickGenerate Scriptand selectSpectrogram Script. The script appears in the Editor.

% Compute spectrogram% Generated by MATLAB(R) 9.13 and Signal Processing Toolbox 9.1.% Generated on: 15-Jun-2022 12:02:38% ParameterstimeLimits = seconds([0 0.002793]);% secondsfrequencyLimits = [0 71428.57];% Hzleakage = 0.9; timeResolution = 0.00028;% secondsoverlapPercent = 85; reassignFlag = true;%%% Index into signal time region of interestsg_batsignal_ROI = sg(:,'batsignal'); sg_batsignal_ROI = sg_batsignal_ROI(timerange(timeLimits(1),timeLimits(2),'closed'),1);% Compute spectral estimate% Run the function call below without output arguments to plot the results[P,F,T] = pspectrum(sg_batsignal_ROI,...'spectrogram',...'FrequencyLimits',frequencyLimits,...'Leakage',leakage,...'TimeResolution'timeResolution,...'OverlapPercent',overlapPercent,...'Reassign',reassignFlag);

Run the script. Plot the reassigned spectrogram.

mesh(seconds(T),F,P) xlabel("Time") ylabel("Frequency") axistightview(2) colormappink

Figure contains an axes object. The axes object with xlabel Time, ylabel Frequency contains an object of type surface.

Use thetfridgefunction to track the ridges.

[fridge,~,lridge] = tfridge(P,F,0.01,NumRidges=3,NumFrequencyBins=10); holdonplot3(seconds(T),fridge,P(lridge),":",linewidth=3) holdoff

Figure contains an axes object. The axes object with xlabel Time, ylabel Frequency contains 4 objects of type surface, line.

多亏了Curtis Condon, Ken White, and Al Feng of the Beckman Center at the University of Illinois for the bat data and permission to use it in this example.

See Also

Apps

Functions

Related Examples

More About

Baidu
map