summaryrefslogtreecommitdiff
path: root/macros/buttap.sci
diff options
context:
space:
mode:
authorBrijeshcr2017-11-10 15:08:11 +0530
committerBrijeshcr2017-11-10 15:08:11 +0530
commit6e1e4362783f68a8e8be1d199337c1ca831a2994 (patch)
tree474529264f6f33a61343467faf80e8330f3c6f85 /macros/buttap.sci
parent487df8d5650f198857d5dd5635f9493fa8c06e8f (diff)
downloadFOSSEE-Signal-Processing-Toolbox-6e1e4362783f68a8e8be1d199337c1ca831a2994.tar.gz
FOSSEE-Signal-Processing-Toolbox-6e1e4362783f68a8e8be1d199337c1ca831a2994.tar.bz2
FOSSEE-Signal-Processing-Toolbox-6e1e4362783f68a8e8be1d199337c1ca831a2994.zip
Brijesh functions
Diffstat (limited to 'macros/buttap.sci')
-rw-r--r--macros/buttap.sci45
1 files changed, 45 insertions, 0 deletions
diff --git a/macros/buttap.sci b/macros/buttap.sci
new file mode 100644
index 0000000..9c2e08d
--- /dev/null
+++ b/macros/buttap.sci
@@ -0,0 +1,45 @@
+function [z, p, g] = buttap (n)
+//Design a lowpass analog Butterworth filter.
+//Calling Sequence
+//z = buttap (n)
+//[z, p] = buttap (n)
+//[z, p, g] = buttap (n)
+//Parameters
+//n: Filter Order
+//z: Zeros
+//p: Poles
+//g: Gain
+//Description
+//This is an Octave function.
+//It designs a lowpass analog Butterworth filter of nth order.
+//Examples
+//[z, p, g] = buttap (5)
+//z = [](0x0)
+//p =
+//
+// -0.30902 + 0.95106i -0.80902 + 0.58779i -1.00000 + 0.00000i -0.80902 - 0.58779i -0.30902 - 0.95106i
+//
+//g = 1
+
+
+funcprot(0);
+lhs = argn(1)
+rhs = argn(2)
+if (rhs < 1 | rhs > 1)
+error("Wrong number of input arguments.")
+end
+
+select(rhs)
+
+ case 1 then
+ if(lhs==1)
+ z = callOctave("buttap",n)
+ elseif(lhs==2)
+ [z, p] = callOctave("buttap",n)
+ elseif(lhs==3)
+ [z, p, g] = callOctave("buttap",n)
+ else
+ error("Wrong number of output argments.")
+ end
+ end
+endfunction