Continue to Site

# how to design median filter

Status
Not open for further replies.

#### ijai_yus84

##### Newbie level 4
i need to know what digital component that is use to design median filter(order 5)?

median filter is nothing but selecting the median of 5 data samples

example

In = [3 7 8 1 4]

out = median(in)

where median(in) = sort the data is acending order and selecte the In(3) = the middle element

so median(in) = middle ( [1 3 4 7 8] )'

out = 4

its simple just the median operation(sort and take the middle value)

hope it helped

The previous remark was absolutely correct, in my opinion, however, 1 peculiarity should be still specified. If the number of discrete-time samples is even (2,4,6,8,...) then median may be defined in 3 alternative ways:

Example: x = [2 5 7 9]

Median1 = 5;
Median2 = 7;
Median3 = (5+7)/2 = 6;

All 3 variants are fair, however usually either the 1st or the 3nd ones are prefered. Such problem will never arise while processing an odd sequence.

Usually, median filter is used for smoothing in order to get rid of jumps, outliers and other undesirable effects, which contaminate and distort signal. That's why the algorithm of median filtration (in Mathlab, for example) is:

S_new(i) = median ( S(i-n/2:i+n/2) ), where n - total number of samples, s - original signal and s_new - the final one. Of course, n may be changed if necessary. The more it is, the more smoothed is the signal.

With respect,

Dmitrij

Status
Not open for further replies.