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 click theTime-Frequencybutton to 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.
Use theLeakageslider to increase the leakage until the RBW is about 4.5 kHz.
Specify the time resolution as 280 microseconds and the overlap between adjoining segments as 85%.
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.12 and Signal Processing Toolbox 9.0.% Generated on: 20-Dec-2021 10:38:20% 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
Use thetfridge
function to track the ridges.
[fridge,~,lridge] = tfridge(P,F,0.01,NumRidges=3,NumFrequencyBins=10); holdonplot3(seconds(T),fridge,P(lridge),":",linewidth=3) holdoff
Thanks to 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
- 找到之间的延迟相关信号
- Resolve Tones by Varying Window Leakage
- Find Interference Using Persistence Spectrum
- Modulation and Demodulation Using Complex Envelope
- Extract Voices from Music Signal
- Resample and Filter a Nonuniformly Sampled Signal
- Declip Saturated Signals Using Your Own Function
- Compute Envelope Spectrum of Vibration Signal
- Extract Regions of Interest from Whale Song
More About
- Using Signal Analyzer App
- Edit Sample Rate and Other Time Information
- Data Types Supported by Signal Analyzer
- Spectrum Computation in Signal Analyzer
- Persistence Spectrum in Signal Analyzer
- Spectrogram Computation in Signal Analyzer
- Scalogram Computation in Signal Analyzer
- Keyboard Shortcuts for Signal Analyzer
- Signal Analyzer Tips and Limitations