summaryrefslogtreecommitdiff
path: root/macros/filter2.sci
diff options
context:
space:
mode:
Diffstat (limited to 'macros/filter2.sci')
-rw-r--r--macros/filter2.sci33
1 files changed, 33 insertions, 0 deletions
diff --git a/macros/filter2.sci b/macros/filter2.sci
new file mode 100644
index 0000000..b8b48e4
--- /dev/null
+++ b/macros/filter2.sci
@@ -0,0 +1,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