# MATLAB Signature Methods

These examples capture distinctive teaching and problem-solving approaches in
the source notes. An AI coworker should consult them before reducing a problem
to a generic toolbox call.

## Manual Short-Time Fourier Transform

**Source:** `MasterTheFourierTransformMATLABPython.pdf`, pp. 76-79

The method moves a tapered window through a nonstationary signal, computes an
FFT for each window, and places each spectrum into a time-frequency matrix.
The figures make the construction visible: select one time segment, apply a
Hann taper, transform it, then rotate and color the result in time-frequency
space.

Why it matters:

- Shows why a static FFT can hide a changing frequency.
- Makes the time-versus-frequency resolution tradeoff concrete.
- Demonstrates a loop that expresses a meaningful moving-window algorithm.
- Provides the conceptual foundation for current `stft` and `spectrogram`
  functions.

Use for chirps, transients, changing spectra, oscilloscope records, and
biomedical signals.

## Fourier Coefficient Scaling and Phase

**Source:** `MasterTheFourierTransformMATLABPython.pdf`, pp. 38-45

The notes connect positive and negative frequencies to Euler's formula, then
separate raw coefficients from correctly scaled amplitude or power. Phase is
treated as information, not discarded after taking `abs(fft(...))`.

Why it matters:

- Prevents plausible-looking spectra with incorrect units.
- Forces the one-sided/two-sided and DC/Nyquist conventions to be explicit.
- Preserves phase for timing, delay, reconstruction, and synchronization work.

## Frequency Resolution Is a Design Choice

**Source:** `MasterTheFourierTransformMATLABPython.pdf`, pp. 56-63

Sampling rate, record length, transform length, zero padding, and matrix
orientation are treated separately. The figures illustrate how performing an
FFT along the wrong matrix dimension can produce a convincing but meaningless
result.

Why it matters:

- Encourages explicit transform dimensions.
- Distinguishes frequency-bin spacing from genuine resolving power.
- Connects acquisition duration to spectral interpretation.

## Fourier Transform as Matrix Multiplication

**Source:** `Incomplete linear algebra3.pdf`, p. 76

The DFT is constructed as a complex Fourier matrix and applied to a vector.
This is not the efficient production implementation, but it exposes the
linear-algebra structure hidden by `fft`.

Why it matters:

- Connects Fourier analysis to basis changes and matrix multiplication.
- Provides a useful small-size verification method.
- Demonstrates when a manual implementation teaches more than a built-in.

## Causal Versus Zero-Phase Filtering

**Source:** `SignalProcessingProblemsMATLABPython.pdf`, pp. 45-47

Filter coefficients, impulse response, magnitude response, phase delay, edge
effects, and forward-backward filtering are compared visually.

Why it matters:

- A filtered waveform can have the expected shape but the wrong timing.
- `filter` and `filtfilt` answer different experimental questions.
- Edge handling and record length belong in the design, not as afterthoughts.

## Convolution in Time and Frequency

**Source:** `SignalProcessingProblemsMATLABPython.pdf`, pp. 59-73

The notes connect kernel flipping, time-domain convolution, spectral
multiplication, Gaussian smoothing, narrow-band filtering, and tapered
frequency-domain filters.

Why it matters:

- Links the physical meaning of a kernel with the Fourier-domain operation.
- Provides multiple formulations that can cross-check each other.
- Supports denoising, feature extraction, and system-response modeling.

## Complex Morlet Wavelet Time-Frequency Analysis

**Sources:**

- `SignalProcessingProblemsMATLABPython.pdf`, pp. 73-81
- `MasterMATLABGuidedProblems_CourseNotes.pdf`, pp. 181-183

A family of complex Morlet wavelets is generated and convolved with the
signal to form a time-frequency representation. The manual construction
exposes the relationship among center frequency, wavelet width, convolution,
power, and temporal localization.

Why it matters:

- Offers a time-frequency method with different resolution behavior from STFT.
- Preserves complex phase information.
- Connects equations, generated wavelets, convolution, and visualization.

## Nonlinear Sine-Wave Fitting

**Source:** `MasterMATLABGuidedProblems_CourseNotes.pdf`, pp. 240-248,
especially p. 245

Sine-wave parameters are estimated through nonlinear optimization rather than
read directly from a plot.

Why it matters:

- Provides a bridge from oscilloscope records to fitted amplitude, frequency,
  phase, and residuals.
- Generalizes to exponential RC curves and other instrument-response models.
- Encourages inspection of the objective function and fit residuals.

## Avoid Explicit Matrix Inversion

**Source:** `Incomplete linear algebra3.pdf`, pp. 122-143,
especially p. 143

The notes develop inverse and pseudoinverse concepts, then warn that explicit
matrix inversion can be unstable and inaccurate.

Why it matters:

- Prefer `A\b` for solving systems.
- Consider QR, SVD, conditioning, and rank when a solution is sensitive.
- Do not translate an algebraic fraction mechanically into `inv(A)*b`.

## Vectorization With Judgment

**Sources:**

- `SignalProcessingProblemsMATLABPython.pdf`, pp. 123-124
- `MasterMATLABGuidedProblems_CourseNotes.pdf`, Sections 3, 14, and 20

Prefer logical indexing and array operations for naturally parallel work, but
retain loops when they represent windows, ordered instrument actions,
iterations, or state.

The decision is semantic:

- Scalar loop over independent array elements: usually vectorize.
- Loop over STFT windows, optimization iterations, or SCPI command order:
  usually retain and preallocate.
