summaryrefslogtreecommitdiff
path: root/macros/sos2zp.sci
blob: 98abc366167bcc154e0864d1ade41f16b103e151 (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
34
35
36
37
38
39
40
41
function [z,p,k] = sos2zp (sos, g)
//This function converts series second-order sections to zeros, poles, and gains (pole residues).
//Calling Sequence
//z = sos2zp (sos)
//z = sos2zp (sos, g)
//[z, p] = sos2zp (...)
//[z, p, k] = sos2zp (...)
//Parameters 
//sos: matrix of real or complex numbers
//g: real or complex value, default value is 1
//z: column vector
//p: column vector
//Description
//This is an Octave function. 
//This function converts series second-order sections to zeros, poles, and gains (pole residues).
//The input is the sos matrix and the second parameter is the overall gain, default value of which is 1.
//The outputs are z, p, k. z and p are column vectors containing zeros and poles respectively, and k is the overall gain. 
//Examples
//[a,b,c]=sos2zp([1,2,3,4,5,6])
//a =
//  -1.0000 + 1.4142i
//  -1.0000 - 1.4142i
//b =
//  -0.6250 + 1.0533i
//  -0.6250 - 1.0533i
//c =  1

funcprot(0);
rhs = argn(2)
if(rhs<1 | rhs>2)
error("Wrong number of input arguments.")
end

	select(rhs)
	case 1 then
	[z,p,k] = callOctave("sos2zp",sos)
	case 2 then
	[z,p,k] = callOctave("sos2zp",sos,g)
	end
endfunction