How to use this calculator
Remove isolated spikes from a short record with an order-statistic filter.
- Enter Uniform samples (signal units), Median window length. Match the units shown beside each field and review the result together with the assumptions below.
- Read the worked example below to check the expected input format and result.
- Compare another scenario by changing one input at a time. Use Reset to return to the starting values.
Centered median impulse rejection explained
Use Uniform samples (signal units) with Median window length to reproduce the sample calculation, then review the stated limits before carrying the result into another scenario.
A numerical walkthrough
Uniform samples (signal units) = [1, 1, 1, 20, 2, 2, 2]; Median window length = 3.
- Filtered center of output: 2 signal units
- Valid output count: 5 samples
- Filtered sample 0: 1 signal units
- Filtered sample 1: 1 signal units
- Filtered sample 2: 2 signal units
- Filtered sample 3: 2 signal units
- Filtered sample 4: 2 signal units
A single amplitude-20 spike lies between levels one and two; a three-point median rejects the isolated excursion.
The model behind the numbers
y[i]=median(x[i],…,x[i+M−1]) for odd M; no boundary padding is introduced.
Only valid full windows produce output. Output sample zero aligns with input index (M−1)/2, rather than the first input sample.
What to enter
x— Uniform samples (signal units)- Chronological real samples; use a comma-separated list in the same signal units. Use comma-separated values in the stated order.
width— Median window length- Odd number of samples; only complete windows are evaluated. Enter a whole number.
Interpreting the result
Median filtering is nonlinear and can remove legitimate narrow pulses; it does not average Gaussian noise like a linear low-pass filter.
Reading the outputs
Every valid filtered sample is shown, plus its count and the middle output value.
Frequently asked questions
Why is the output shorter?
Incomplete edge windows are discarded instead of padded.
Will a two-sample spike survive?
It can survive a three-point median because it occupies the majority of a window.
Can I use an even window?
This page requires a unique middle order statistic.
How do I use the Centered median impulse rejection calculator?
Enter Uniform samples (signal units), Median window length. Match the units shown beside each field and review the result together with the assumptions below.
What is a worked example of Centered median impulse rejection?
Uniform samples (signal units) = [1, 1, 1, 20, 2, 2, 2]; Median window length = 3. Filtered center of output: 2 signal units Valid output count: 5 samples Filtered sample 0: 1 signal units Filtered sample 1: 1 signal units Filtered sample 2: 2 signal units Filtered sample 3: 2 signal units Filtered sample 4: 2 signal units A single amplitude-20 spike lies between levels one and two; a three-point median rejects the isolated excursion.
Read our calculation methodology.