A median filter on a vector has a size, for example, a size of 3 means calculating the median of every three values in the vector. The first and last elements are left alone
belongs to book: MATLAB: A Practical Introduction to Programming and Problem Solving|Stormy Attaway|Fourth Edition| Chapter number:14| Question number:6.14
All Answers
total answers (1)
medianFilter3.m
function outvec = medianFilter3(vec)
% Computes a median filter with a size of 3
% Format of call: medianFilter3(vector)
% Returns a median filter with size 3
outvec = vec;
for i = 2:length(vec) - 1
outvec(i) = median([vec(i-1) vec(i) vec(i+1)]);
end
end
need an explanation for this answer? contact us directly to get an explanation for this answer