summaryrefslogtreecommitdiff
path: root/macros/zp2tf.sci
diff options
context:
space:
mode:
authorbgtushar2017-11-23 19:30:44 +0530
committerbgtushar2017-11-23 19:30:44 +0530
commite9ab4b0b52db51be30f4ac3d07673c20b48da13c (patch)
tree8f4ce37de0a028350125acfce71cfe686e79ef24 /macros/zp2tf.sci
parent14ccddd315f0b97a78e965df1587835ac542e35a (diff)
parentf66d58166a67d6bc89b2a674119410ddaee53d46 (diff)
downloadFOSSEE-Signal-Processing-Toolbox-e9ab4b0b52db51be30f4ac3d07673c20b48da13c.tar.gz
FOSSEE-Signal-Processing-Toolbox-e9ab4b0b52db51be30f4ac3d07673c20b48da13c.tar.bz2
FOSSEE-Signal-Processing-Toolbox-e9ab4b0b52db51be30f4ac3d07673c20b48da13c.zip
Merge
Diffstat (limited to 'macros/zp2tf.sci')
-rw-r--r--macros/zp2tf.sci46
1 files changed, 46 insertions, 0 deletions
diff --git a/macros/zp2tf.sci b/macros/zp2tf.sci
new file mode 100644
index 0000000..c830e3d
--- /dev/null
+++ b/macros/zp2tf.sci
@@ -0,0 +1,46 @@
+function [num, den] = zp2tf (z, p, k)
+//Converts zeros / poles to a transfer function.
+//Calling Sequence
+//[num, den] = zp2tf (z, p, k)
+//num = zp2tf (z, p, k)
+//Parameters
+//z: Zeros
+//p: Poles
+//k: Leading coefficient
+//Num: Numerator of the transfer function
+//den: Denomenator of the transfer function
+//Description
+//This is an Octave function.
+//It converts zeros / poles to a transfer function.
+//Examples
+//z = [1 2 3]
+// p = [4 5 6]
+//k = 5
+//[num, den] = zp2tf (z, p, k)
+//num =
+//
+// 5 -30 55 -30
+//
+//den =
+//
+// 1 -15 74 -120
+
+funcprot(0);
+lhs = argn(1)
+rhs = argn(2)
+if (rhs < 3 | rhs > 3)
+error("Wrong number of input arguments.")
+end
+
+select(rhs)
+
+ case 3 then
+ if(lhs==1)
+ num = callOctave("zp2tf", z, p, k)
+ elseif(lhs==2)
+ [num, den] = callOctave("zp2tf", z, p, k)
+ else
+ error("Wrong number of output argments.")
+ end
+ end
+endfunction