matlab/matlab-agentic-toolkit / skills-catalog/signal-processing/matlab-analyze-time-frequency-content
matlab-analyze-time-frequency-content
UnverifiedPerform time-frequency analysis in MATLAB using CWT, STFT, synchrosqueezing, reassignment, wavelet coherence, cross spectrogram, EMD/VMD, multiresolution analysis, and time-frequency filtering. Triggers on: time-frequency, spectrogram, scalogram, cwt, stft, istft, fsst, wsst, wcoherence, xspectrogram, modwt, modwtmra, modwpt, emd, vmd, hht, tffilt, dgt, gabor, instantaneous frequency, synchrosqueezing, reassignment, ridge extraction, wavelet coherence, cross spectrum, mode decomposition, signal decomposition, time-frequency filtering.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 10.7 KB |
| manifest.yaml | config | 517 B |
| references/cross-analysis-guide.md | markdown | 11.7 KB |
| references/cwt-guide.md | markdown | 22.3 KB |
| references/method-selection-guide.md | markdown | 6.2 KB |
| references/multiresolution-guide.md | markdown | 17.9 KB |
| references/reassignment-guide.md | markdown | 11.8 KB |
| references/stft-guide.md | markdown | 16.4 KB |
| scripts/assessBoundary.m | other | 3.1 KB |
| scripts/assessSignalForTF.m | other | 4.8 KB |
| scripts/assessSpectralEnergy.m | other | 3.4 KB |
| scripts/boundaryExDisjointSine.mat | binary | 7.6 KB |
| scripts/illustrateBoundary.m | other | 902 B |
| scripts/illustrateTransientLocalization.m | other | 1.3 KB |
| scripts/plotAntiAnalyticScalogram.m | other | 831 B |
scripts/assessSpectralEnergy.m
View on GitHubfunction assessSpectralEnergy(x, Fs, options)
%assessSpectralEnergy Compute PSD to suggest FrequencyLimits for CWT.
% assessSpectralEnergy(x, Fs) analyzes the power spectral density of the
% signal x sampled at Fs Hz and recommends FrequencyLimits to reduce CWT
% computation by focusing on the energy-containing band.
%
% assessSpectralEnergy(x, Fs, EnergyThreshold=0.99) specifies the
% fraction of total energy to capture (default 99%).
arguments
x (:, 1) double {mustBeNonempty, mustBeFinite}
Fs (1, 1) double {mustBePositive}
options.EnergyThreshold (1, 1) double ...
{mustBeGreaterThan(options.EnergyThreshold, 0), ...
mustBeLessThan(options.EnergyThreshold, 1)} = 0.99
end
% Compute PSD using Welch's method
[pxx, f] = pwelch(x, [], [], [], Fs);
% Cumulative energy distribution
totalEnergy = trapz(f, pxx);
cumEnergy = cumtrapz(f, pxx) / totalEnergy;
% Find band containing specified energy fraction
threshold = options.EnergyThreshold;
lowerIdx = find(cumEnergy >= (1 - threshold) / 2, 1, "first");
upperIdx = find(cumEnergy >= (1 + threshold) / 2, 1, "first");
fLow = f(lowerIdx);
fHigh = f(upperIdx);
fNyquist = Fs / 2;
% Check energy near boundaries
nearNyquist = cumEnergy(end) - cumEnergy(round(0.9 * length(f))) > 0.05;
nearDC = cumEnergy(round(0.1 * length(f))) > 0.05;
% Visualize
figure
tiledlayout(2, 1)
nexttile
plot(f, 10*log10(pxx))
xlabel("Frequency (Hz)")
ylabel("PSD (dB/Hz)")
title("Power Spectral Density")
xline(fLow, "r--", sprintf("%.2f Hz", fLow), LineWidth=1.2)
xline(fHigh, "r--", sprintf("%.2f Hz", fHigh), LineWidth=1.2)
nexttile
plot(f, cumEnergy * 100)
xlabel("Frequency (Hz)")
ylabel("Cumulative Energy (%)")
title(sprintf("Cumulative Energy (%.0f%% band shown)", threshold * 100))
yline(threshold * 100, "k--")
xline(fLow, "r--", LineWidth=1.2)
xline(fHigh, "r--", LineWidth=1.2)
% Print analysis
fprintf("\n=== Spectral Energy Assessment ===\n")
fprintf("Signal length: %d samples\n", length(x))
fprintf("Sampling frequency: %.2f Hz\n", Fs)
fprintf("Nyquist frequency: %.2f Hz\n", fNyquist)
fprintf("\nEnergy band (%.0f%%): %.4f Hz to %.4f Hz\n", ...
threshold * 100, fLow, fHigh)
fprintf("Significant energy near Nyquist (>Fs*0.9): %s\n", string(nearNyquist))
fprintf("Significant energy near DC (<Fs*0.1): %s\n", string(nearDC))
fprintf("\n--- Recommendation ---\n")
if fHigh < 0.8 * fNyquist && fLow > 0.01 * Fs
fprintf("Energy is concentrated in [%.4f, %.4f] Hz.\n", fLow, fHigh)
fprintf("Suggested FrequencyLimits: [%.4f %.4f]\n", fLow, fHigh)
fprintf("This will significantly reduce CWT computation.\n")
elseif nearNyquist
fprintf("Significant energy near Nyquist.\n")
fprintf("Consider setting upper FrequencyLimit to Fs/2 = %.2f Hz.\n", fNyquist)
if fLow > 0.01 * Fs
fprintf("Lower limit can be raised to %.4f Hz.\n", fLow)
fprintf("Suggested FrequencyLimits: [%.4f %.4f]\n", fLow, fNyquist)
end
else
fprintf("Energy is broadly distributed.\n")
fprintf("Default FrequencyLimits are appropriate.\n")
fprintf("Or use [0 %.2f] for maximum coverage.\n", fNyquist)
end
fprintf("==================================\n\n")
end
% Copyright 2026 The MathWorks, Inc.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |