fix macro name in %zpk_v_zpk overload
[scilab.git] / scilab / modules / overloading / macros / %zpk_v_zpk.sci
1 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2 // Copyright (C)  2016 - INRIA - Serge Steer
3 //
4 // This file is licensed under the terms of the GNU GPL v2.0,
5 // pursuant to article 5.3.4 of the CeCILL v.2.1.
6 // For more information, see the COPYING file which you should have received
7 // along with this program.
8 function r=%zpk_v_zpk(a,b)
9     //r=a./b for zpk systems
10     [ma,na]=size(a)
11     [mb,nb]=size(b)
12     if a.dt<>b.dt then
13         error(msprintf(_("%s: time domains are not compatible.\n"),"[a,b]"))
14     end
15     if ma*na==1 then
16         Z=cell(mb,nb);P=cell(mb,nb);
17         for k=1:nb
18             for l=1:mb
19                 Z{l,k}=[b.P{l,k};a.Z{1}]
20                 P{l,k}=[b.Z{l,k};a.P{1}]
21             end
22         end
23         K=a.K.*b.K
24     elseif mb*nb==1 then
25         Z=cell(ma,na);P=cell(ma,na);K=zeros(ma,na);
26         for k=1:na
27             for l=1:ma
28                 Z{l,k}=[b.P{1};a.Z{l,k}]
29                 P{l,k}=[b.Z{1};a.P{l,k}]
30             end
31         end
32         K=a.K./b.K
33     else
34         if ma<>mb|na<>nb then
35             error(msprintf(_("%s: Incompatible input arguments #%d and #%d: Same dimensions expected.\n"),"a./b",1,2))
36         end
37         Z=cell(ma,na);P=cell(ma,na);K=zeros(ma,na);
38         for k=1:na
39             for l=1:ma
40                 Z{l,k}=[b.P{l,k};a.Z{l,k}]
41                 P{l,k}=[b.Z{l,k};a.P{l,k}]
42             end
43         end
44         K=a.K./b.K
45     end
46     r=simplify_zp(zpk(Z,P,K,a.dt));
47 endfunction