Skip to content

Processing Blocks

Spectral Analysis

Describe how fast something shakes or repeats, so the model can tell rhythmic movements apart.

Try it in Studio
On this page

What is this block?

Spectral Analysis looks at one window of motion data and measures which speeds of repetition are in it. A slow wave of the hand repeats about once per second. A shaking motor repeats many times per second. The block turns each axis into a list of numbers: one number for each speed (frequency).

Why do we use it?

Many movements are easier to recognise by their rhythm than by their raw numbers. Two "shake" recordings may look different sample by sample, but both have strong energy at the same frequency. Spectral Analysis makes that shared pattern easy for the model to see.

How does it work?

For every selected axis, the block:

  1. Multiplies the values by Scale axes.
  2. Optionally keeps every 2nd, 4th, 8th or 16th sample (Input decimation ratio), to focus on slow movements.
  3. Optionally removes very slow or very fast changes with a filter (Filter → Type).
  4. Splits the window into pieces of FFT length samples and measures the frequencies in each piece with an FFT (Fast Fourier Transform).
  5. Converts the result to decibels (Take log of spectrum?) and averages the pieces.

If a window has fewer samples than the FFT length, PetalEdge pads it with zeros up to the FFT length and analyses it as one piece.

What input does it receive?

One window from the impulse, with every axis you selected (for example accX, accY and accZ).

What output does it produce?

A list of FFT length ÷ 2 + 1 numbers for each axis. With the default FFT length of 256 that is 129 numbers per axis, so 387 numbers for three axes. Each number says how strong one frequency is in that window.

What do its settings mean?

Settings are on the block's Parameters tab in Studio.

SettingDefaultWhat changing it does
Scale axes1Multiplies all values. Use it when one sensor's numbers are much larger or smaller than another's.
Input decimation ratio1Keeps every Nth sample (with smoothing first). Higher values give more detail at slow frequencies.
Filter → TypenoneLow-pass keeps slow changes, high-pass keeps fast changes, bandpass keeps a range.
Cut-off frequency100 HzWhere the filter starts. Shown only when a filter is selected. For bandpass it is the lower edge.
Cut-off frequency (high)200 HzUpper edge of a bandpass filter.
Order4How sharply the filter cuts. Higher is sharper.
FFT length256Number of samples per FFT piece. Larger values give finer frequency detail and more output numbers.
Take log of spectrum?onShows the result in decibels, so quiet and loud frequencies are both visible.
Overlap FFT frames?onLets the FFT pieces overlap by half, so no part of the window is missed between pieces.

Simple example

You record three gestures at 100 Hz: idle, wave (about 1 movement per second) and shake (about 5 movements per second).

  • idle gives low numbers at every frequency.
  • wave gives a peak near 1 Hz.
  • shake gives a peak near 5 Hz.

After Generate features, the three labels form separate groups in the feature explorer, and a small Classification model can learn them quickly.

When should I use it?

  • Use it for repeating movements, vibration and activities such as walking or running.
  • Try Flatten instead for slow, steady movements or postures, where rhythm does not matter.
  • Try Raw Data instead when the shape of a single movement matters more than its rhythm, together with a 1D Convolutional learning block.