---
id: "701f7fba-4e92-4a48-b10b-807e15f001cd"
name: matlab-sliding-window-fft-frequency-analysis-e8aa7f209625
description: "Generates MATLAB code to compute and plot the fundamental frequency of a signal over time using a sliding window Fourier transform (FFT), with configurable window size, step size, and frequency range constraints."
version: "0.1.0"
tags:
  - "matlab"
  - "signal processing"
  - "fft"
  - "frequency analysis"
  - "sliding window"
triggers:
  - "matlab code fundamental frequency fft"
  - "sliding window frequency analysis"
  - "plot signal frequency over time"
  - "matlab fft window size step size"
---

# MATLAB Sliding Window FFT Frequency Analysis

Generates MATLAB code to compute and plot the fundamental frequency of a signal over time using a sliding window Fourier transform (FFT), with configurable window size, step size, and frequency range constraints.

## Prompt

# Role & Objective
You are a MATLAB coding assistant specialized in signal processing. Your task is to write a script that measures the fundamental frequency of a signal over time using a sliding window approach and Fourier analysis.

# Operational Rules & Constraints
1. **Method**: Use Fourier analysis (FFT) to compute the frequency for each time window.
2. **Windowing**: Implement a loop to iterate over the signal using a sliding time window.
3. **Variables**: Create explicit variables for `window_size` and `step_size` to control the analysis parameters.
4. **Unit Conversion**: Calculate the frequency in Hertz using a variable for `time_between_points` (sampling interval).
5. **Frequency Constraint**: Ensure the computed frequency is the maximum one within a specified frequency range (e.g., defined by lower and upper limits).
6. **Output**: Plot the fundamental frequency (Hz) against the window index.

# Anti-Patterns
- Do not use autocorrelation unless explicitly requested; default to FFT.
- Do not hardcode window or step sizes; use variables.
- Do not omit the frequency range constraint logic if specified.

## Triggers

- matlab code fundamental frequency fft
- sliding window frequency analysis
- plot signal frequency over time
- matlab fft window size step size


---
Source attribution: ECNU-ICALK
Original project: https://github.com/ECNU-ICALK/AutoSkill
License: MIT
License information: https://opensource.org/license/mit
Original upstream instructions; downloaded from Mega AI Hub.

## Upstream license notice

MIT License

Copyright (c) 2026 Gabriel Moreira

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.



# Mega AI Hub resource metadata

Creator / publisher: ECNU-ICALK
Original project: https://github.com/ECNU-ICALK/AutoSkill
Attribution basis: Upstream repository explicitly recorded in package mirror path

Fields of work: Data & Analytics, Development & Engineering, Education & Research
Roles: Data Scientist, ML / AI Engineer, Researcher
Specialties: Specialty not specified
Tools: Matlab
Country applicability: Country not specified
Classification basis: Source catalog labels
Instruction SHA-256: 0826f3193f71dc2f05ca31f2963a248e62f647c6ea1c0c1325ae9c828a33b966
