Functions | |
if (nargin >=3) if(nargin > | |
if (la==0||lb==0) k | |
elseif (la==1) k | |
p (m) | |
endfor | if (lb >=la)[k |
if (isa(a,"single")||isa(b,"single")) small | |
endif | p (abs(p)< small)=0 |
p (index) | |
if (lp==1) r | |
ri (ip) | |
A (:, ip) | |
endif | if (nargin< 5) e |
endif if | numel (e) indx |
endfor | if (numel(k)) pnum |
endif | if (isa(r,"single")||isa(p,"single")||isa(k,"single")) small |
endif | pnum (abs(pnum)< small)=0 |
pden (abs(pden)< small)=0 | |
!assert (abs(r-[-2;7;3])< 1e-12%!&&abs(p-[2;2;1])< 1e-12%!&&isempty(k)%!&&e==[1;2;1]) | |
!assert ((abs(br-b)< 1e-12%!&&abs(ar-a)< 1e-12)) | |
!assert ((abs(b-[1,-5, 9,-3, 1])< 1e-12%!&&abs(a-[1,-5, 8,-4])< 1e-12)) | |
!assert ((abs(rr-r(n))< 1e-12%!&&abs(pr-p(n))< 1e-12%!&&abs(kr-k)< 1e-12%!&&abs(er-e(n))< 1e-12)) | |
Variables | |
function [r, p, k, e] | |
endif | toler = .001 |
else | e = [] |
endif [r, p] = rresidue (b, a, varargin{1}, toler, e) | |
return endif | a = polyreduce (a) |
b = polyreduce (b) | |
la = length (a) | |
lb = length (b) | |
return | |
r = p = e = [] | |
endif | p = roots (a) |
lp = length (p) | |
p_group = cumsum (e == 1) | |
for | ng |
else | k = [] |
endif | small = max (abs (p)) |
index = (abs (imag (p)) < small) | |
endif | aorder = numel (a) - 1 |
border = aorder - 1 | |
A = zeros (border+1, border+1) | |
B = prepad (reshape (b, [numel(b), 1]), border+1, 0) | |
for | ip |
else [e, indx] = mpoles (p, toler, 0) | |
endif | indx = 1:numel(p) |
for | n |
else | pden = conv (pden, pn) |
endif endfor | D = numel (pden) - 1 |
K = numel (k) - 1 | |
N = K + D | |
pnum = zeros (1, N+1) | |
for | m |
else | pm = conv (pm, p1) |
endif endfor | pn = deconv (pden, pm) |
endfunction!test | !b = [1, 1, 1] |
!a = [1, -5, 8, -4] | |
!k = [1 0] | |
!r1 = residue (b, a) [-5i | |
!p1 = [+3i | |
!test | !r = [7 |
!p = [2 | |
!e = [2 |
!assert | ( | (abs(rr-r(n))< 1e-12%!&&abs(pr-p(n))< 1e-12%!&&abs(kr-k)< 1e-12%!&&abs(er-e(n))< 1e-12) | ) |
!assert | ( | (abs(b-[1,-5, 9,-3, 1])< 1e-12%!&&abs(a-[1,-5, 8,-4])< 1e-12) | ) |
!assert | ( | (abs(br-b)< 1e-12%!&&abs(ar-a)< 1e-12) | ) |
!assert | ( | ) |
A | ( | : | , | |
ip | ||||
) |
elseif | ( | la | = =1 |
) |
endif if | ( | ) |
if | ( | lp | = =1 |
) |
if | ( | isa(a,"single")||isa(b,"single") | ) |
if | ( | nargin >= | 3 | ) |
p | ( | index | ) |
endif p | ( | ) | [pure virtual] |
p | ( | m | ) |
pden | ( | ) | [pure virtual] |
endif pnum | ( | ) | [pure virtual] |
ri | ( | ip | ) |
!a = [1, -5, 8, -4] |
!test !b = [1, 1, 1] |
!e = [2 |
!k = [1 0] |
!p = [2 |
!p1 = [+3i |
!test !r = [7 |
!r1 = residue (b, a) [-5i |
a = polyreduce (a) |
endfor b = polyreduce (b) |
endfunction function[pnum, pden, e] |
error index = (abs (imag (p)) < small) |
K = numel (k) - 1 |
la = length (a) |
lb = length (b) |
lp = length (p) |
N = K + D |
p = roots (a) |
pden = conv (pden, pn) |
pnum = zeros (1, N+1) |
r = p = e = [] |
return |