Signal Processing Stack Exchange is a question and answer site for practitioners of the art and science of signal, image and video processing. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How a mean filter is called as linear filter and a median filter is called as non linear filter? I understand how a mean and median filter operates, but I was not able to relate with the term linear and non-linear. Please explain me with an example.

share|improve this question
up vote 12 down vote accepted

Nonlinear filters are those for which the linearity relationship breaks down. Consider two signals $A$ and $B$, for linear filter such as mean filter $F_m$,you have $F_m(A+\lambda B) = F_m(A) + \lambda F_m(B)$, but the equation is not satisfied for an nonlinear filter such as the median filter.

In application, the median filter removes outliers and shot noise that is independent of magnitude, while mean filter serves as smoothing purpose.

share|improve this answer

linear vs non-linear

To understand the linearity property more easily.Let us consider the above diagram,here we have 2 sequences namely Xn and Yn. when we add both the sequence we get Xn+Yn whose amplitude value are represented with blue colour. when any system which satisfy this condition then it is called linear. In case of mean filter, mean value for sequence Xn is 1+1+3/3=5/3.mean value for sequence Yn is 1+2+0/3=1.mean value for Xn+Yn is 2+3+3/3=8/3.

$ mean(Xn)+mean(Yn)= mean(Xn+Yn), \\ \\ 5/3 + 1 = 8/3 $

hence we called mean filter as linear filter. In case of median filter, if we calculate median value for sequence Xn, we get 1 (arrange the sequence in ascending order and then find the middle value). similarly median value of sequence Yn is 1 .median value of sequence Xn+Yn is 3.

$median(Xn)+median(Yn) \neq median(Xn+Yn).\\ \\ 1 + 1 \neq 3 $

hence we call median filter as non-linear filter

share|improve this answer

In a linear filter, the output will change linearly with a change in the input. You could plot some sort of straight line from the relationship between the two.

A median filter can change non-linearly with certain input changes. e.g. take an input vector where all the data values are different: a change in a non-middle value won't affect the median output at all, until when that value rises or falls enough to become the middle item, when it can suddenly completely affect the output. Thus producing a kinked line (non-linear), instead of a straight line (linear) when the relationship is plotted.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.