summaryrefslogtreecommitdiff
path: root/692/CH2/EX2.16/P2_16.sce
blob: 8beec200647b75ba0ed88d9b81c4232e8f730a18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//EXAMPLE 2.16, 
clear;
clc;
//Given input sequence = [3 4 5]
x=[0 3 4 5 0];
disp([3 4 5],'Input sequence = ')
//determining median filter
//first sequence
for k=2:4
    if  x(k)>x(k-1) & x(k+1)>x(k-1) & x(k+1)>x(k)
         y(k-1)=x(k);
     else
         x(k-1)>x(k+1) & x(k)>x(k+1) & x(k)>x(k-1)
         y(k-1)=x(k-1);
    end
end
disp(y','The Median Filter of the given input is =');