matlab-analyze-spectrum
Analyze signal spectra in MATLAB using nonparametric and parametric estimators
Install / Use
npx skills add matlab/matlab-agentic-toolkit --skill matlab-analyze-spectrumInstalls into whichever agent you are using.
SKILL.md
Installable skill definition
Quality Score
Category
OtherSupported Platforms
Tags
Our assessment of matlab-analyze-spectrum
matlab-analyze-spectrum scores 90/100 on our quality scale, 104th of 354 Other skills we index (top 30%).
Its SKILL.md is 21 KB long, well organised into 25 sections with 11 code examples: a thorough specification that gives an agent plenty to work with.
With 1,098 GitHub stars, it is one of the more widely adopted skills in the catalogue.
Maintenance, license and trust
- The repository was last updated about 2 months ago, so matlab-analyze-spectrum is actively maintained.
- Our last check on 2026-11-21 found the source still online.
- No license is declared. By default that means all rights are reserved: you can read it, but reusing or redistributing it is not clearly permitted. Ask the author before building on it commercially.
- Its trust signals score 88/100, with 1 caution from licensing, adoption, age or documentation. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.
Safety scan
No issues foundOur scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful.
AI review by kimi-k2.7-code on 2026-10-07. Automated pattern scan on 2026-10-07. It catches known dangerous patterns, not every risk — read a skill before letting an agent act on it.
matlab-analyze-spectrum compared with similar skills
All 4 of these similar skills score higher than matlab-analyze-spectrum; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| matlab-analyze-spectrum (this skill)by matlab | 90 | 1.1k | 2mo ago | SKILL.md |
| algorithmic-artby anthropics | 100 | 177.9k | 2mo ago | SKILL.md |
| pptxby anthropics | 100 | 177.9k | 2mo ago | SKILL.md |
| prospectingby coreyhaines31 | 100 | 60.1k | 11d ago | SKILL.md |
| ad-creativeby coreyhaines31 | 100 | 60.1k | 11d ago | SKILL.md |
Frequently asked questions
- How do I install matlab-analyze-spectrum?
- Run
npx skills add matlab/matlab-agentic-toolkit --skill matlab-analyze-spectrum. The install tabs above show the steps for each supported agent. - Which AI agents does matlab-analyze-spectrum work with?
- It is written for Universal, as a SKILL.md file. Other agents that read the same format can often use it too.
- Is matlab-analyze-spectrum safe to use?
- Our scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful. It declares no license and scores 88/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is matlab-analyze-spectrum still maintained?
- The repository was last updated about 2 months ago, so matlab-analyze-spectrum is actively maintained.
Skill content
View source on GitHubname: matlab-analyze-spectrum description: > Analyze signal spectra in MATLAB using nonparametric and parametric estimators. Use when computing frequency content, PSD, power spectrum, spectral peaks, bandwidth, or streaming spectral analysis. Covers pspectrum, pwelch, periodogram, pmtm, pburg, pmusic, rootmusic, plomb, poctave, spectrumAnalyzer, dsp.SpectrumEstimator. TRIGGER: FFT, PSD, power spectrum, spectral analysis, frequency content, bandwidth measurement, spectral leakage, window selection, streaming spectrum, periodicity, resolve close frequencies, multitaper. DO NOT TRIGGER: filter design, spectrogram/time-frequency, audio features. license: https://www.mathworks.com/content/dam/mathworks/license/pmrl/license.md metadata: author: MathWorks version: "1.0"
Analyze Signal Spectra in MATLAB
Compute, visualize, and extract measurements from signal spectra using Signal Processing Toolbox. Choose the right spectral estimator, avoid common FFT pitfalls, and use built-in measurement functions instead of reinventing them.
When to Use
- Computing frequency content of a signal (FFT, periodogram, PSD, power spectrum)
- Estimating power spectral density (Welch, periodogram, parametric)
- Comparing frequency content of two signals (cross-spectrum, coherence)
- Finding spectral peaks (dominant frequencies, harmonics)
- Measuring bandwidth, band power, or occupied bandwidth
- Visualizing frequency-domain data
- Streaming (real-time, frame-by-frame) spectral analysis with
spectrumAnalyzer,dsp.SpectrumEstimator,dsp.CrossSpectrumEstimator
When NOT to Use
- Designing or applying filters -- use
matlab-design-digital-filter - Time-frequency/spectrogram analysis (including
spectrumAnalyzerspectrogram ViewType, STFT, reassignment, CWT) -- use the time-frequency analysis skill (TBD) - Audio-specific features (MFCC, pitch, auditory models) -- use Audio Toolbox
- Control system frequency response (Bode, Nyquist) -- use Control System Toolbox
Workflow
- Batch or streaming? -- Determine if data is already in workspace (batch) or arrives frame-by-frame (streaming). See below.
- Preliminary analysis -- When user provides data, run diagnostics to inform technique selection (see below)
- Pre-process -- Check for NaN/gaps (use
plombfor non-uniform data). Applydetrend(x)only if DC/trend visibly distorts the spectrum - Choose output type -- PSD, power spectrum, amplitude spectrum, or octave bands (see below)
- Choose estimator -- Use preliminary analysis results + Estimator Selection below
- Compute spectrum -- Use the chosen function with explicit
Fs(if available) - Visualize -- Plot with proper axis labels (Hz, dB or linear units)
- Extract metrics -- Use
findpeaks,bandpower,obw,powerbw. Seereferences/peak-detection.md - Verify -- Parseval's theorem, known tone levels. See
references/power-from-spectrum.md
Batch vs Streaming
Determine the processing mode before choosing tools:
| Indicator | Mode | Tools |
|-----------|------|-------|
| Entire signal in workspace (vector/matrix) | Batch | pwelch, pspectrum, periodogram, pburg, etc. |
| Data arrives frame-by-frame (sensor, ADC, real-time loop) | Streaming | spectrumAnalyzer, dsp.SpectrumEstimator, dsp.CrossSpectrumEstimator |
| Need live-updating spectrum display | Streaming | spectrumAnalyzer (ViewType: spectrum) |
| Need spectrum values for real-time decisions | Streaming | dsp.SpectrumEstimator (returns numeric output each frame) |
If streaming: See references/streaming-spectral-analysis.md for System object APIs, properties, and patterns. DSP System Toolbox is required.
The rest of this skill covers batch processing. For streaming, the reference file provides full guidance including the batch-to-streaming mapping table.
Preliminary Data Analysis
When the user provides signal data (variable, file, or description), run diagnostic checks before recommending a technique. See references/preliminary-analysis.md for full code.
Quick checks (run in order — stop early if decisive):
- Sampling type — Fs given → uniform. Time vector with small jitter (<5%) →
pspectrum(x,t)(resamples internally). Large jitter or truly non-uniform →plomb - Data quality — NaN/Inf, DC offset, trend → preprocess first
- Length — <128: parametric only. 128–1024:
periodogram/pburg. >10k:pwelchpreferred - Spectral character — Run
periodogram(Hann), compute spectral flatness + peak count + strongest peak width:- Flatness >0.3 → wideband →
pwelch(peaks are just noise fluctuations) - Flatness <0.1, strongest peak narrow (width < 10×df) → tonal →
periodogram(...,'power')orrootmusic - Flatness <0.1, strongest peak wide (width ≥ 10×df) → wideband-structured (chirps, shaped bands) →
pwelch+obw - Flatness 0.1–0.3, peaks present → mixed →
pwelch+findpeaks
- Flatness >0.3 → wideband →
- AR fitness — Fit AR models with
arburg, track prediction error vs order. If error plateaus <10% at low order →pburgis strong candidate - Tone count — If tonal: count peaks with
findpeaks, cross-check with eigenvalue drop. Known count + resolution-limited →rootmusic(x,2*nTones,Fs)
Report findings to the user before computing the spectrum:
Preliminary Analysis:
- Sampling: uniform at [Fs] Hz
- Duration: [X] s ([N] samples), resolution: [df] Hz
- Spectral character: [wideband/tonal/mixed]
- AR fit: [quality] (order [N], residual [X]%)
Recommendation: [estimator] because [justification]
Output Type Selection
| User's Goal | Output Type | Function / Option |
|-------------|-------------|-------------------|
| Compare to a standard or another signal (length-independent) | PSD (power/Hz) | pwelch (default), periodogram |
| Read amplitude of a specific tone | Power spectrum → sqrt | pspectrum(x,Fs) (default); periodogram(x,w,N,Fs,'power') or pwelch(x,w,[],[],Fs,'power') for explicit control |
| Measure total power in a band | PSD then integrate, or use bandpower | bandpower(x,Fs,[fLow fHigh]) |
| Octave-band levels (acoustics, vibration) | Fractional-octave spectrum | poctave(x,Fs,'BandsPerOctave',3) |
| Detect frequencies in nearly-uniform data (small jitter) | Power spectrum | pspectrum(x,t) — resamples internally |
| Detect frequencies in non-uniform/gapped data | Lomb-Scargle | plomb(x,t) |
PSD vs Power Spectrum: PSD (power/Hz) is resolution-independent — broadband noise stays flat when you change parameters. Power spectrum (power/bin) is tone-friendly — peak height equals true tone power. Use PSD for noise characterization and specs (g²/Hz, dBm/Hz); use power spectrum for reading tone amplitudes. Convert: PS = PSD × RBW where RBW = enbw(win)*Fs/segLen.
Estimator Selection
Decision tree (simple → specialized):
- Just want to see what frequencies are present? →
pspectrum(x,Fs) - Need a smooth, low-variance PSD? →
pwelch(favored for long signals — segment averaging reduces variance) orperiodogram(short signal, cannot segment) - Need accurate tone amplitude from peaks? →
periodogram(x,win,N,Fs,'power')thensqrt - Need octave-band levels (acoustics, vibration)? →
poctave(x,Fs,'BandsPerOctave',3) - Comparing two signals at each frequency? →
mscohere(related?) /cpsd(shared content + phase) - Data is nearly uniform (small jitter)? →
pspectrum(x,t)(resamples internally). Truly non-uniform or large gaps? →plomb(x,t) - Need to resolve sinusoids closer than Fs/N? →
rootmusic/pmusic(must know # of sinusoids) - Short data, want low-variance PSD without segmenting? →
pmtm(multitaper — uses orthogonal DPSS tapers on full record; no AR assumption) - Short data, want smooth sidelobe-free PSD? →
pburg(assumes signal is AR-like)
Quick reference table:
| Goal | Function | When to use |
|------|----------|-------------|
| Quick look at frequency content | pspectrum | Default -- good defaults, tune Leakage (0–1) for resolution vs sidelobes |
| Single-sided amplitude spectrum | periodogram with 'power' | Need amplitude per bin |
| PSD with low variance | pwelch | Long signals — averaging segments reduces variance; preferred when signal is long enough to segment |
| PSD of short signal, low variance | pmtm | Multitaper — uses full record with orthogonal DPSS tapers; no segmentation needed |
| PSD of short signal | periodogram | Too short to segment; high variance (single window) |
| Resolve closely-spaced sinusoids | pmusic, rootmusic | Known # of sinusoids, super-resolution |
| Smooth PSD of short AR-like data | pburg | No sidelobes; NOT for resolving tones |
Default: Start with pspectrum. Drop to pwelch/periodogram for explicit control. Never use manual FFT unless user explicitly asks — redirect to built-in functions.
pspectrum vs pwelch: pspectrum outputs power spectrum (Kaiser beta=20, ~76% overlap). pwelch defaults to PSD. They match within ~0.2 dB using equivalent parameters. See references/pspectrum-equivalence.md for exact mapping. Resolution control in pspectrum: Use FrequencyResolution (Hz) to set target resolution directly, or Leakage (0–1) to control the resolution/sidelobe trade-off indirectly. TimeResolution is spectrogram-only — do NOT use it for power spectrum. Leakage parameter: pspectrum(x,Fs,Leakage=L) where L ∈ [0,1] — 0 = minimum leakage (max sidelobe suppression, widest main lobe), 1 = maximum leakage (rectangular window, best resolution), default 0.5.
Nonparametric vs Parametric: Use nonparametric (FFT-based) when signal is long or spectral shape is unknown. Use parametric when data is short, signal matches an AR model, or you need super-resolution. See references/estimator-comparison.md for detailed trade-offs.
Window Selection
| Goal | Window | Why | |------|--------|-----| | General-purpose PSD | Hann | Good balance, 50% overlap optimal | | Detect weak tone near strong tone | Blackman-Harris or Kaiser (beta≥10) | Low sidelobes (-92 dB) | | Resolve two close frequencies | Hann or Kaiser (beta=5) | Narrow main lobe | | Accurate amplitude measurement | Flat Top | ~0.01 dB scalloping loss | | Tunable trade-off | Kaiser(N,beta) | Single parameter controls curve |
Key rule: Higher sidelobe suppression costs wider main lobe. Only suppress as much as dynamic range requires. See references/spectral-windows.md for ENBW values and overlap guidelines.
Key Functions
| Function | Purpose |
|----------|---------|
| pspectrum | Power spectrum with automatic defaults; Leakage parameter (0–1) controls resolution vs sidelobe suppression |
| periodogram | PSD or power spectrum via single-window DFT |
| pwelch | PSD via Welch's averaged periodogram |
| pmtm | PSD via Thomson's multitaper method (DPSS/Slepian tapers) |
| cpsd | Cross power spectral density |
| mscohere | Magnitude-squared coherence (0 to 1) |
| pburg / pyulear | AR PSD (Burg / Yule-Walker) |
| pmusic / peig | Pseudospectrum (MUSIC / eigenvector) |
| rootmusic | Frequency estimation via root-MUSIC |
| findpeaks | Locate spectral peaks |
| refinepeaks | Sub-bin peak frequency/amplitude refinement (use after findpeaks) |
| bandpower | Power in a frequency band |
| obw / powerbw | Occupied bandwidth / 3-dB power bandwidth |
| meanfreq / medfreq | Mean / median frequency of spectrum |
| sfdr | Spurious free dynamic range |
| toi | Third-order intercept point (two-tone intermodulation) |
| spectralFlatness | Spectral flatness (0=tonal, 1=white noise) |
| spectralCrest | Spectral peak-to-mean ratio |
| spectralKurtosis | Spectral kurtosis (transient/non-stationarity detection) |
| poctave | Fractional-octave spectrum |
| plomb | Lomb-Scargle periodogram (non-unif
Truncated for display — read the full file on GitHub.
Related Skills
algorithmic-art
177.9kCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems.
pptx
177.9kUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an em…
prospecting
60.1kWhen the user wants to find and qualify prospects for outbound, or asks who to target first, which signal to prioritize, or where to spot buyers with the problem: buying signals, enrichment, verification, account research.
ad-creative
60.1kWhen the user wants to write or judge ad creative, or asks which ad, hook, or angle to run or kill: headlines, primary text, and variations for Google, Meta, LinkedIn, and TikTok, fresh angles when creative fatigues. Test hypotheses name the metric, comparison, and expected direction.
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.
