EQ overloads the == operator for pzmodel objects. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: EQ overloads the == operator for pzmodel objects. Checks that the pzmodel have identical pole/zero/gain values. CALL: result = eq(p1,p2) INPUTS: p1,p2 - input pzmodel objects OUTPUTS: If the two pzmodel objects are considered equal, result == 1, otherwise, result == 0. VERSION: $Id: param.m,v 1.7 2007/08/17 11:22:11 ingo Exp $ HISTORY: 29-08-2007 M Hewitson Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function result = eq(p1,p2) 0002 0003 % EQ overloads the == operator for pzmodel objects. 0004 % 0005 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0006 % 0007 % DESCRIPTION: EQ overloads the == operator for pzmodel objects. 0008 % 0009 % Checks that the pzmodel have identical pole/zero/gain values. 0010 % 0011 % CALL: result = eq(p1,p2) 0012 % 0013 % INPUTS: p1,p2 - input pzmodel objects 0014 % 0015 % OUTPUTS: If the two pzmodel objects are considered equal, result == 1, 0016 % otherwise, result == 0. 0017 % 0018 % VERSION: $Id: param.m,v 1.7 2007/08/17 11:22:11 ingo Exp $ 0019 % 0020 % HISTORY: 29-08-2007 M Hewitson 0021 % Creation 0022 % 0023 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0024 0025 % Assume they are equal 0026 result = 1; 0027 0028 %% Check gain 0029 if p1.gain ~= p2.gain 0030 result = 0; 0031 return 0032 end 0033 0034 %% Check poles 0035 0036 if length(p1.poles) ~= length(p2.poles) 0037 result = 0; 0038 return 0039 end 0040 0041 for j=1:length(p1.poles) 0042 if p1.poles(j) ~= p2.poles(j) 0043 result = 0; 0044 return 0045 end 0046 end 0047 0048 %% Check poles 0049 0050 if length(p1.zeros) ~= length(p2.zeros) 0051 result = 0; 0052 return 0053 end 0054 0055 for j=1:length(p1.zeros) 0056 if p1.zeros(j) ~= p2.zeros(j) 0057 result = 0; 0058 return 0059 end 0060 end 0061