summaryrefslogtreecommitdiff
path: root/macros/tf2zp.sci
diff options
context:
space:
mode:
Diffstat (limited to 'macros/tf2zp.sci')
-rw-r--r--macros/tf2zp.sci18
1 files changed, 13 insertions, 5 deletions
diff --git a/macros/tf2zp.sci b/macros/tf2zp.sci
index ca10fd4..f607ba0 100644
--- a/macros/tf2zp.sci
+++ b/macros/tf2zp.sci
@@ -1,13 +1,14 @@
// Copyright (C) 2018 - IIT Bombay - FOSSEE
-//
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution. The terms
// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
-//Original contribution: FOSSEE, IIT Bombay
+// Original Source : https://octave.sourceforge.io/signal/
+// Modifieded by: Abinash Singh Under FOSSEE Internship
+// Date of Modification: 3 Feb 2024
+// Organization: FOSSEE, IIT Bombay
// Email: toolbox@scilab.in
-
function [z,p,k]=tf2zp(num,den)
// Transfer function to zero pole conversion
@@ -60,8 +61,9 @@ function [z,p,k]=tf2zp(num,den)
if(rd>1) then
error("Denominator must be row vector");
- elseif np>cod then
- error("Improper transfer function");
+
+ // elseif np>cod then
+ // error("Improper transfer function"); it is a bug it should be removed
end
if (~isempty(den)) then
coef=den(1);
@@ -98,3 +100,9 @@ function [z,p,k]=tf2zp(num,den)
end
z=roots(num);
endfunction
+/*
+Note : This function is tested with Octave's outputs as a reference.
+[z p k] = tf2zp([9.6500e+02 -1.1773e+05 3.8648e+06 -4.5127e+071.5581e+08],[ 1 -3 2]) //pass
+[z p k] = tf2zp([1 2 3 4],[ 1 -3 2]) //pass
+[z p k] = tf2zp([4 5 6],[1]) // pass
+*/ \ No newline at end of file