| DSP Blockset | Search  Help Desk |
| Median | See Also |
Find the median value of a vector input.
Library
Statistics, in Math FunctionsDescription
The Median block outputs the median value of the elements in a vector input.y = median(u) % equivalent MATLAB code for vector inputFor odd-length inputs, the block sorts the input elements by value, and outputs the central element of the sorted vector,
y = s((n+1)/2)where
s is the sorted vector and n=length(u). For even-length inputs, the block sorts the input elements by value, and outputs the average of the two central elements in the sorted vector.
y = mean([s(n/2) s(n/2+1)])A matrix input,
u, is treated as a vector, u(:).
Note
Dialog Box

See Also
Maximummedian (MATLAB)