summaryrefslogtreecommitdiff
path: root/macros/filter2.sci
blob: b8b48e4cfbaa8eaa33fc722bd88df0b8d86070eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
function Y = filter2 (B, X, SHAPE)
//Apply the 2-D FIR filter B to X.
//Calling Sequence
//Y = filter2(B, X)
//Y = filter2(B, X, SHAPE)
//Parameters
//B, X: Matrix  
// SHAPE: 
//        'full':  pad X with zeros on all sides before filtering.
//        'same': unpadded X (default)
//        'valid': trim X after filtering so edge effects are no included. 
//Description
//This function applies the 2-D FIR filter B to X. If the argument SHAPE is specified, return an array of the desired shape.
//Examples
//filter2([1,3], [4,5])
//ans = 
//     19.    5.  
funcprot(0);
lhs = argn(1)
rhs = argn(2)
if (rhs < 2 | rhs > 3)
error("Wrong number of input arguments.")
end

select(rhs)
	
	case 2 then
        Y=callOctave("filter2",B,X)
	case 3 then
		Y = callOctave("filter2",B,X,SHAPE)
    end

endfunction