diff testing/utp_1.1/utps/pzmodel/utp_pzmodel_resp.m @ 44:409a22968d5e default

Add unit tests
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Tue, 06 Dec 2011 18:42:11 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testing/utp_1.1/utps/pzmodel/utp_pzmodel_resp.m	Tue Dec 06 18:42:11 2011 +0100
@@ -0,0 +1,1008 @@
+% UTP_PZMODEL_RESP a set of UTPs for the pzmodel/resp method
+%
+% M Hewitson 06-08-08
+%
+% $Id: utp_pzmodel_resp.m,v 1.7 2010/03/15 15:57:06 ingo Exp $
+%
+
+% <MethodDescription>
+%
+% The resp method of the pzmodel class returns the complex response of a pzmodel
+% as an Analysis Object. For a command with no output variables plots the method
+% the result into a diagram.
+%
+% </MethodDescription>
+
+function results = utp_pzmodel_resp(varargin)
+
+  % Check the inputs
+  if nargin == 0
+
+    % Some keywords
+    class   = 'pzmodel';
+    mthd    = 'resp';
+
+    results = [];
+    disp('******************************************************');
+    disp(['****  Running UTPs for ' class '/' mthd]);
+    disp('******************************************************');
+
+    % Test PZMODEL objects
+    [pz1, pz2, pz3, pz4, pz5, pzv, pzm] = get_test_objects_pzmodel;
+
+    % Exception list for the UTPs:
+    [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples();
+
+    warning('This UTP needs a complete update');
+    
+    % Run the tests
+    results = [results utp_01];    % getInfo call
+    results = [results utp_02];    % Vector input
+    results = [results utp_03];    % Matrix input
+    results = [results utp_04];    % List input
+    results = [results utp_05];    % Test with mixed input
+    results = [results utp_06];    % Test history is working
+    results = [results utp_07];    % Test the modify call works
+    results = [results utp_08];    % Test input data shape == output data shape
+    results = [results utp_09];    % Test output of the data
+    results = [results utp_10];    % Test with f = ao.y
+    results = [results utp_11];    % Test with f
+    results = [results utp_12];    % Test with f1, f2 and nf
+    results = [results utp_13];    % Test with f1, f2 and nf AND 'scale'
+
+    % Make surethat all figures are closed
+    close all;
+
+    disp('Done.');
+    disp('******************************************************');
+
+  elseif nargin == 1 % Check for UTP functions
+    if strcmp(varargin{1}, 'isutp')
+      results = 1;
+    else
+      results = 0;
+    end
+  else
+    error('### Incorrect inputs')
+  end
+
+  %% UTP_01
+
+  % <TestDescription>
+  %
+  % Tests that the getInfo call works for this method.
+  %
+  % </TestDescription>
+  function result = utp_01
+
+
+    % <SyntaxDescription>
+    %
+    % Test that the getInfo call works for no sets, all sets, and each set
+    % individually.
+    %
+    % </SyntaxDescription>
+
+    try
+      % <SyntaxCode>
+      % Call for no sets
+      io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']);
+      % Call for all sets
+      io(2) = eval([class '.getInfo(''' mthd ''')']);
+      % Call for each set
+      for kk=1:numel(io(2).sets)
+        io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']);
+      end
+      % </SyntaxCode>
+      stest = true;
+    catch err
+      disp(err.message)
+      stest = false;
+    end
+
+    % <AlgoDescription>
+    %
+    % 1) Check that getInfo call returned an minfo object in all cases.
+    % 2) Check that all plists have the correct parameters.
+    %
+    % </AlgoDescription>
+
+    atest = true;
+    if stest
+      % <AlgoCode>
+      % check we have minfo objects
+      if isa(io, 'minfo')
+        %%% SET 'None'
+        if ~isempty(io(1).sets), atest = false; end
+        if ~isempty(io(1).plists), atest = false; end
+        %%% Check all Sets
+        if ~any(strcmpi(io(2).sets, 'List')), atest = false; end
+        if ~any(strcmpi(io(2).sets, 'Range')), atest = false; end
+        if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end
+        %%%%%%%%%%   SET 'List'
+        if io(3).plists.nparams ~= 2, atest = false; end
+        % Check key
+        if ~io(3).plists.isparam('f'), atest = false; end
+        if ~io(3).plists.isparam('bank'),  atest = false; end
+        % Check default value
+        if ~isEmptyDouble(io(3).plists.find('f')), atest = false; end
+        if ~isequal(io(3).plists.find('bank'),  'none'), atest = false; end
+        % Check options
+        if ~isequal(io(3).plists.getOptionsForParam('f'), {[]}), atest = false; end
+        if ~isequal(io(3).plists.getOptionsForParam('bank'),  {'none', 'serial', 'parallel'}), atest = false; end
+        %%%%%%%%%%   SET 'Range'
+        if io(4).plists.nparams ~= 5, atest = false; end
+        % Check key
+        if ~io(4).plists.isparam('f1'), atest = false; end
+        if ~io(4).plists.isparam('f2'), atest = false; end
+        if ~io(4).plists.isparam('nf'), atest = false; end
+        if ~io(4).plists.isparam('scale'), atest = false; end
+        if ~io(4).plists.isparam('bank'),  atest = false; end
+        % Check default value
+        if ~isEmptyDouble(io(4).plists.find('f1')), atest = false; end
+        if ~isEmptyDouble(io(4).plists.find('f2')), atest = false; end
+        if ~isequal(io(4).plists.find('nf'), 1000), atest = false; end
+        if ~isequal(io(4).plists.find('scale'), 'log'), atest = false; end
+        if ~isequal(io(4).plists.find('bank'),  'none'), atest = false; end
+        % Check options
+        if ~isequal(io(4).plists.getOptionsForParam('f1'), {[]}), atest = false; end
+        if ~isequal(io(4).plists.getOptionsForParam('f2'), {[]}), atest = false; end
+        if ~isequal(io(4).plists.getOptionsForParam('nf'), {1000}), atest = false; end
+        if ~isequal(io(4).plists.getOptionsForParam('scale'), {'lin', 'log'}), atest = false; end
+        if ~isequal(io(4).plists.getOptionsForParam('bank'),  {'none', 'serial', 'parallel'}), atest = false; end
+      end
+      % </AlgoCode>
+    else
+      atest = false;
+    end
+
+    % Return a result structure
+    result = utp_prepare_result(atest, stest, dbstack, mfilename);
+  end % END UTP_01
+
+  %% UTP_02
+
+  % <TestDescription>
+  %
+  % Tests that the resp method works with a vector of PZMODEL objects as input.
+  %
+  % </TestDescription>
+  function result = utp_02
+
+    % <SyntaxDescription>
+    %
+    % Test that the resp method works for a vector of PZMODEL objects as input.
+    % Test the method with an output and with no output (a diagram must appear)
+    %
+    % </SyntaxDescription>
+
+    try
+      % <SyntaxCode>
+      % Make sure that all figures are closed.
+      close all;
+      resp(pzv);
+      out = resp(pzv);
+      % </SyntaxCode>
+      stest = true;
+    catch err
+      disp(err.message)
+      stest = false;
+    end
+
+    % <AlgoDescription>
+    %
+    % 1) Test the right number of lines in the diagram.
+    % 2) Check that the number of elements in 'out' is the same as in 'pzv'
+    % 3) Check that each output PZMODEL contains the correct data.
+    %
+    % </AlgoDescription>
+
+    atest = true;
+    if stest
+      % <AlgoCode>
+      % Get the current figure.
+      fi = gcf;
+      % Get ALL axes including the legends.
+      ax = get(fi, 'Children');
+      % Select only the 'axes' with the lines
+      ax = ax(ismember(get(ax(:), 'Tag'), ''));
+      % Get the lines of both axes
+      lines = get(ax(:), 'Children');
+      % Check that the diagram have the same number of lines as the output
+      % object
+      if max(cellfun('size', lines, 1)) ~= numel(pzv), atest = false; end
+      % Check the number of output objects.
+      if ~isequal(size(out), size(pzv)), atest = false; end
+      % Check each output against the default values for f1, f2 and nf
+      for ii = 1:numel(out)
+        f1 = getlowerFreq(pzv(ii))/10;
+        f2 = getupperFreq(pzv(ii))*10;
+        nf = find(pzmodel.getInfo('resp', 'Range').plists, 'nf');
+        if ~isa(out(ii), 'ao'), atest = false; end
+        if ~strcmp(out(ii).hist.methodInfo.mname, 'resp'), atest = false; end
+        if out(ii).x(1)     ~= f1, atest = false; end
+        if out(ii).x(end)   ~= f2, atest = false; end
+        if numel(out(ii).x) ~= nf, atest = false; end
+      end
+      % </AlgoCode>
+    else
+      atest = false;
+    end
+
+    % Return a result structure
+    result = utp_prepare_result(atest, stest, dbstack, mfilename);
+  end % END UTP_02
+
+  %% UTP_03
+
+  % <TestDescription>
+  %
+  % Tests that the resp method works with a matrix of PZMODEL objects as input.
+  %
+  % </TestDescription>
+  function result = utp_03
+
+    % <SyntaxDescription>
+    %
+    % Test that the resp method works for a matrix of PZMODEL objects as input.
+    % Test the method with an output and with no output (a diagram must appear)
+    %
+    % </SyntaxDescription>
+
+    try
+      % <SyntaxCode>
+      % Make sure that all figures are closed.
+      close all;
+      pzmat = [pz5, pz3, pz2; pz1, pz5, pz3];
+      resp(pzmat);
+      out = resp(pzmat);
+      % </SyntaxCode>
+      stest = true;
+    catch err
+      disp(err.message)
+      stest = false;
+    end
+
+    % <AlgoDescription>
+    %
+    % 1) Test the right number of lines in the diagram.
+    % 2) Check that the number of elements in 'out' is the same as in 'pzmat'
+    % 3) Check that each output PZMODEL contains the correct data.
+    %
+    % </AlgoDescription>
+
+    atest = true;
+    if stest
+      % <AlgoCode>
+      % Get the current figure.
+      fi = gcf;
+      % Get ALL axes including the legends.
+      ax = get(fi, 'Children');
+      % Select only the 'axes' with the lines
+      ax = ax(ismember(get(ax(:), 'Tag'), ''));
+      % Get the lines of both axes
+      lines = get(ax(:), 'Children');
+      % Check that the diagram have the same number of lines as the output
+      % object
+      if max(cellfun('size', lines, 1)) ~= numel(pzmat), atest = false; end
+      % Check the number of output objects.
+      if ~isequal(size(out), size(pzmat)), atest = false; end
+      % Check each output against the default values for f1, f2 and nf
+      for ii = 1:numel(out)
+        f1 = getlowerFreq(pzmat(ii))/10;
+        f2 = getupperFreq(pzmat(ii))*10;
+        nf = find(pzmodel.getInfo('resp', 'Range').plists, 'nf');
+        if ~isa(out(ii), 'ao'), atest = false; end
+        if ~strcmp(out(ii).hist.methodInfo.mname, 'resp'), atest = false; end
+        if out(ii).x(1)     ~= f1, atest = false; end
+        if out(ii).x(end)   ~= f2, atest = false; end
+        if numel(out(ii).x) ~= nf, atest = false; end
+      end
+      % </AlgoCode>
+    else
+      atest = false;
+    end
+
+    % Return a result structure
+    result = utp_prepare_result(atest, stest, dbstack, mfilename);
+  end % END UTP_03
+
+  %% UTP_04
+
+  % <TestDescription>
+  %
+  % Tests that the pzmat method works with a list of PZMODEL objects as input.
+  %
+  % </TestDescription>
+  function result = utp_04
+
+    % <SyntaxDescription>
+    %
+    % Test that the resp method works for a list of PZMODEL objects as input.
+    % Test the method with an output and with no output (a diagram must appear)
+    %
+    % </SyntaxDescription>
+
+    try
+      % <SyntaxCode>
+      close all;
+      resp(pz1,pz2,pz3);
+      out = resp(pz1,pz2,pz3);
+      % </SyntaxCode>
+      stest = true;
+    catch err
+      disp(err.message)
+      stest = false;
+    end
+
+    % <AlgoDescription>
+    %
+    % 1) Test the right number of lines in the diagram.
+    % 2) Check that the number of elements in 'out' is the same as in 'pzmat'
+    % 3) Check that each output PZMODEL contains the correct data.
+    %
+    % </AlgoDescription>
+
+    atest = true;
+    pzin = [pz1,pz2,pz3];
+    if stest
+      % <AlgoCode>
+      % Get the current figure.
+      fi = gcf;
+      % Get ALL axes including the legends.
+      ax = get(fi, 'Children');
+      % Select only the 'axes' with the lines
+      ax = ax(ismember(get(ax(:), 'Tag'), ''));
+      % Get the lines of both axes
+      lines = get(ax(:), 'Children');
+      % Check that the diagram have the same number of lines as the output
+      % object
+      if max(cellfun('size', lines, 1)) ~= numel(pzin), atest = false; end
+      % Check the number of output objects.
+      if ~isequal(size(out), size(pzin)), atest = false; end
+      % Check each output against the default values for f1, f2 and nf
+      for ii = 1:numel(out)
+        f1 = getlowerFreq(pzin(ii))/10;
+        f2 = getupperFreq(pzin(ii))*10;
+        nf = find(pzmodel.getInfo('resp', 'Range').plists, 'nf');
+        if ~isa(out(ii), 'ao'), atest = false; end
+        if ~strcmp(out(ii).hist.methodInfo.mname, 'resp'), atest = false; end
+        if out(ii).x(1)     ~= f1, atest = false; end
+        if out(ii).x(end)   ~= f2, atest = false; end
+        if numel(out(ii).x) ~= nf, atest = false; end
+      end
+      % </AlgoCode>
+    else
+      atest = false;
+    end
+
+    % Return a result structure
+    result = utp_prepare_result(atest, stest, dbstack, mfilename);
+  end % END UTP_04
+
+  %% UTP_05
+
+  % <TestDescription>
+  %
+  % Tests that the resp method works with a mix of different shaped PZMODEL
+  %  objects as input.
+  %
+  % </TestDescription>
+  function result = utp_05
+
+    % <SyntaxDescription>
+    %
+    % Test that the resp method works with an input of matrices and vectors
+    % and single PZMODEL objects. Test the method with an output and with no
+    % output (a diagram must appear)
+    %
+    % </SyntaxDescription>
+
+    try
+      % <SyntaxCode>
+      close all;
+      pzmat = [pz5, pz3, pz2; pz1, pz5, pz3];
+      resp(pz1,pzv,pz2,pzmat,pz3);
+      out = resp(pz1,pzv,pz2,pzmat,pz3);
+      % </SyntaxCode>
+      stest = true;
+    catch err
+      disp(err.message)
+      stest = false;
+    end
+
+    % <AlgoDescription>
+    %
+    % 1) Test the right number of lines in the diagram.
+    % 2) Check that the number of elements in 'out' is the same as in 'pzmat'
+    % 3) Check that each output PZMODEL contains the correct data.
+    %
+    % </AlgoDescription>
+
+    atest = true;
+    pzin  = [pz1,reshape(pzv,1,[]),pz2,reshape(pzmat,1,[]),pz3];
+    if stest
+      % <AlgoCode>
+      % Get the current figure.
+      fi = gcf;
+      % Get ALL axes including the legends.
+      ax = get(fi, 'Children');
+      % Select only the 'axes' with the lines
+      ax = ax(ismember(get(ax(:), 'Tag'), ''));
+      % Get the lines of both axes
+      lines = get(ax(:), 'Children');
+      % Check that the diagram have the same number of lines as the output
+      % object
+      if max(cellfun('size', lines, 1)) ~= numel(pzin), atest = false; end
+      % Check the number of output objects.
+      if ~isequal(size(out), size(pzin)), atest = false; end
+      % Check each output against the default values for f1, f2 and nf
+      for ii = 1:numel(out)
+        f1 = getlowerFreq(pzin(ii))/10;
+        f2 = getupperFreq(pzin(ii))*10;
+        nf = find(pzmodel.getInfo('resp', 'Range').plists, 'nf');
+        if ~isa(out(ii), 'ao'), atest = false; end
+        if ~strcmp(out(ii).hist.methodInfo.mname, 'resp'), atest = false; end
+        if out(ii).x(1)     ~= f1, atest = false; end
+        if out(ii).x(end)   ~= f2, atest = false; end
+        if numel(out(ii).x) ~= nf, atest = false; end
+      end
+      % </AlgoCode>
+    else
+      atest = false;
+    end
+
+    % Return a result structure
+    result = utp_prepare_result(atest, stest, dbstack, mfilename);
+  end % END UTP_05
+
+  %% UTP_06
+
+  % <TestDescription>
+  %
+  % Tests that the resp method properly applies history.
+  %
+  % </TestDescription>
+  function result = utp_06
+
+    % <SyntaxDescription>
+    %
+    % Test that the result of applying the resp method can be processed back.
+    %
+    % </SyntaxDescription>
+
+    try
+      % <SyntaxCode>
+      close all;
+      resp(pz5);
+      out  = resp(pz5);
+      mout = rebuild(out);
+      % </SyntaxCode>
+      stest = true;
+    catch err
+      disp(err.message)
+      stest = false;
+    end
+
+    % <AlgoDescription>
+    %
+    % 1) Check that the last entry in the history of 'out' corresponds to
+    %    'resp'.
+    % 2) Check that re-built object is the same object as the input.
+    %
+    % </AlgoDescription>
+
+    atest = true;
+    if stest
+      % <AlgoCode>
+      % Get the current figure.
+      fi = gcf;
+      % Get ALL axes including the legends.
+      ax = get(fi, 'Children');
+      % Select only the 'axes' with the lines
+      ax = ax(ismember(get(ax(:), 'Tag'), ''));
+      % Get the lines of both axes
+      lines = get(ax(:), 'Children');
+      x  = get(lines{1}, 'XData');
+      y1 = get(lines{1}, 'YData');
+      y2 = get(lines{2}, 'YData');
+      if ~isequal(x, out.x.'), atest = false; end
+      if ~isequal(y2, abs(out.y)'), atest = false; end
+      if ~isequal(y1, utils.math.phase(out.y)'), atest = false; end
+      % Check the last step in the history of 'out'
+      if ~strcmp(out.hist.methodInfo.mname, 'resp'), atest = false; end
+      % Run 'test.m' and check the result
+      if ~eq(mout, out, ple2), atest = false; end
+      % </AlgoCode>
+    else
+      atest = false;
+    end
+
+    % Return a result structure
+    result = utp_prepare_result(atest, stest, dbstack, mfilename);
+  end % END UTP_06
+
+  %% UTP_07
+
+  % <TestDescription>
+  %
+  % Tests that modify command plots the response into a diagram.
+  %
+  % </TestDescription>
+  function result = utp_07
+
+    % <SyntaxDescription>
+    %
+    % Tests that modify command plots the response into a diagram.
+    %
+    % </SyntaxDescription>
+
+    try
+      % <SyntaxCode>
+      close all;
+      pz5.resp();
+      % </SyntaxCode>
+      stest = true;
+    catch err
+      disp(err.message)
+      stest = false;
+    end
+
+    % <AlgoDescription>
+    %
+    % 1) Check the response diagram.
+    %
+    % </AlgoDescription>
+
+    atest = true;
+    if stest
+      % <AlgoCode>
+      % Get the current figure.
+      fi = gcf;
+      % Get ALL axes including the legends.
+      ax = get(fi, 'Children');
+      % Select only the 'axes' with the lines
+      ax = ax(ismember(get(ax(:), 'Tag'), ''));
+      % Get the lines of both axes
+      lines = get(ax(:), 'Children');
+      x  = get(lines{1}, 'XData');
+      f1 = getlowerFreq(pz5)/10;
+      f2 = getupperFreq(pz5)*10;
+      nf = find(pzmodel.getInfo('resp', 'Range').plists, 'nf');
+      if x(1)     ~= f1, atest = false; end
+      if x(end)   ~= f2, atest = false; end
+      if numel(x) ~= nf, atest = false; end
+      % </AlgoCode>
+    else
+      atest = false;
+    end
+
+    % Return a result structure
+    result = utp_prepare_result(atest, stest, dbstack, mfilename);
+  end % END UTP_07
+
+  %% UTP_08
+
+  % <TestDescription>
+  %
+  % Test the shape of the output.
+  %
+  % </TestDescription>
+  function result = utp_08
+
+    % <SyntaxDescription>
+    %
+    % Test that the output AO of the resp method keeps the shape of the used
+    % input f vector.
+    %
+    % </SyntaxDescription>
+
+    try
+      % <SyntaxCode>
+      arow = ao(1:100, linspace(.1, 5, 100));
+      acol = arow.';
+      f    = linspace(.1, 5, 100);
+      out1 = resp(pz5, arow);
+      out2 = resp(pz5, acol);
+      out3 = resp(pz5, f);
+      % </SyntaxCode>
+      stest = true;
+    catch err
+      disp(err.message)
+      stest = false;
+    end
+
+    % <AlgoDescription>
+    %
+    % 1) Check that the shape of the data doesn't change.
+    %
+    % </AlgoDescription>
+
+    atest = true;
+    if stest
+      % <AlgoCode>
+      % Check the shape of the output data
+      if size(out1.data.y,1) ~= 1, atest = false; end
+      if size(out1.data.y,2) == 1, atest = false; end
+      if size(out2.data.y,1) == 1, atest = false; end
+      if size(out2.data.y,2) ~= 1, atest = false; end
+      if size(out3.data.y,1) ~= 1, atest = false; end
+      if size(out3.data.y,2) == 1, atest = false; end
+      % </AlgoCode>
+    else
+      atest = false;
+    end
+
+    % Return a result structure
+    result = utp_prepare_result(atest, stest, dbstack, mfilename);
+  end % END UTP_08
+
+  %% UTP_09
+
+  % <TestDescription>
+  %
+  % Check that the resp method pass back the output objects to a list of
+  % output variables or to a single variable.
+  %
+  % </TestDescription>
+  function result = utp_09
+
+    % <SyntaxDescription>
+    %
+    % Call the method with a list of output variables and with a single output
+    % variable. Additionaly check that the rebuild method works on the output.
+    %
+    % </SyntaxDescription>
+
+    try
+      % <SyntaxCode>
+      [o1, o2] = resp(pz5, pz3);
+      o3  = resp(pz5, pz3);
+      mout1 = rebuild(o1);
+      mout2 = rebuild(o2);
+      mout3 = rebuild(o3);
+      % </SyntaxCode>
+      stest = true;
+    catch err
+      disp(err.message)
+      stest = false;
+    end
+
+    % <AlgoDescription>
+    %
+    % 1) Check that the output contains the right number of objects
+    % 2) Check that the 'rebuild' method produces the same object as 'out'.
+    %
+    % </AlgoDescription>
+
+    atest = true;
+    if stest
+      % <AlgoCode>
+      % Check the number of outputs
+      if numel(o1) ~=1, atest = false; end
+      if numel(o2) ~=1, atest = false; end
+      if numel(o3) ~=2, atest = false; end
+      % Check the rebuilding of the object
+      if ~eq(o1, mout1, ple2), atest = false; end
+      if ~eq(o2, mout2, ple2), atest = false; end
+      if ~eq(o3, mout3, ple2), atest = false; end
+      % </AlgoCode>
+    else
+      atest = false;
+    end
+
+    % Return a result structure
+    result = utp_prepare_result(atest, stest, dbstack, mfilename);
+  end % END UTP_09
+
+  %% UTP_10
+
+  % <TestDescription>
+  %
+  % Check that the resp method uses the x-data of an input AO for f-vector.
+  %
+  % </TestDescription>
+  function result = utp_10
+
+    % <SyntaxDescription>
+    %
+    % Call the method with different method to pass an AO in.
+    %
+    % </SyntaxDescription>
+
+    try
+      % <SyntaxCode>
+      f1 = .1;
+      f2 = 5;
+      nf = 100;
+      axy = ao(linspace(f1, f2, nf), randn(100,1));
+      afs = ao(linspace(f1, f2, nf), randn(100,1), plist('type', 'fsdata'));
+      out1 = resp(pz5, axy);
+      out2 = resp(pz5, afs);
+      out3 = resp(pz5, plist('f', axy));
+      out4 = resp(pz5, plist('f', afs));
+
+      mout1 = rebuild(out1);
+      mout2 = rebuild(out2);
+      mout3 = rebuild(out3);
+      mout4 = rebuild(out4);
+      % </SyntaxCode>
+      stest = true;
+    catch err
+      disp(err.message)
+      stest = false;
+    end
+
+    % <AlgoDescription>
+    %
+    % 1) Check the output
+    % 2) Check that the 'rebuild' method produces the same object as 'out'.
+    %
+    % </AlgoDescription>
+
+    atest = true;
+    if stest
+      % <AlgoCode>
+      % Check the output
+      if ~isa(out1, 'ao'), atest = false; end
+      if ~isa(out2, 'ao'), atest = false; end
+      if ~isa(out3, 'ao'), atest = false; end
+      if ~isa(out4, 'ao'), atest = false; end
+      if out1.x(1)     ~= f1, atest = false; end
+      if out1.x(end)   ~= f2, atest = false; end
+      if numel(out1.x) ~= nf, atest = false; end
+      if out2.x(1)     ~= f1, atest = false; end
+      if out2.x(end)   ~= f2, atest = false; end
+      if numel(out2.x) ~= nf, atest = false; end
+      if out3.x(1)     ~= f1, atest = false; end
+      if out3.x(end)   ~= f2, atest = false; end
+      if numel(out3.x) ~= nf, atest = false; end
+      if out4.x(1)     ~= f1, atest = false; end
+      if out4.x(end)   ~= f2, atest = false; end
+      if numel(out4.x) ~= nf, atest = false; end
+      % Check the rebuilding of the object
+      if ~eq(out1, mout1, ple2), atest = false; end
+      if ~eq(out2, mout2, ple2), atest = false; end
+      if ~eq(out3, mout3, ple2), atest = false; end
+      if ~eq(out4, mout4, ple2), atest = false; end
+      % </AlgoCode>
+    else
+      atest = false;
+    end
+
+    % Return a result structure
+    result = utp_prepare_result(atest, stest, dbstack, mfilename);
+  end % END UTP_10
+
+  %% UTP_11
+
+  % <TestDescription>
+  %
+  % Check that the resp method uses the specified f-vector to compute the response.
+  %
+  % </TestDescription>
+  function result = utp_11
+
+    % <SyntaxDescription>
+    %
+    % Call the method with different method to pass an f-vector in.
+    %
+    % </SyntaxDescription>
+
+    try
+      % <SyntaxCode>
+      f1 = .1;
+      f2 = 5;
+      nf = 100;
+      f  = linspace(f1, f2, nf);
+      out1 = resp(pz5, f);
+      out2 = resp(pz5, plist('f', f));
+
+      mout1 = rebuild(out1);
+      mout2 = rebuild(out2);
+      % </SyntaxCode>
+      stest = true;
+    catch err
+      disp(err.message)
+      stest = false;
+    end
+
+    % <AlgoDescription>
+    %
+    % 1) Check the output
+    % 2) Check that the 'rebuild' method produces the same object as 'out'.
+    %
+    % </AlgoDescription>
+
+    atest = true;
+    if stest
+      % <AlgoCode>
+      % Check the output
+      if ~isa(out1, 'ao'), atest = false; end
+      if ~isa(out2, 'ao'), atest = false; end
+      if out1.x(1)     ~= f1, atest = false; end
+      if out1.x(end)   ~= f2, atest = false; end
+      if numel(out1.x) ~= nf, atest = false; end
+      if out2.x(1)     ~= f1, atest = false; end
+      if out2.x(end)   ~= f2, atest = false; end
+      if numel(out2.x) ~= nf, atest = false; end
+      % Check the rebuilding of the object
+      if ~eq(out1, mout1, ple2), atest = false; end
+      if ~eq(out2, mout2, ple2), atest = false; end
+      % </AlgoCode>
+    else
+      atest = false;
+    end
+
+    % Return a result structure
+    result = utp_prepare_result(atest, stest, dbstack, mfilename);
+  end % END UTP_11
+
+  %% UTP_12
+
+  % <TestDescription>
+  %
+  % Check that the resp method uses the specified f1, f2, and nf to compute the response.
+  %
+  % </TestDescription>
+  function result = utp_12
+
+    % <SyntaxDescription>
+    %
+    % Call the method with different method to pass f1, f2, and nf in.
+    %
+    % </SyntaxDescription>
+
+    try
+      % <SyntaxCode>
+      f1 = .1;
+      f2 = 5;
+      nf = 100;
+      nf2 = 123;
+      out1 = resp(pz5, f1, f2);
+      out2 = resp(pz5, f1, f2, nf);
+      out3 = resp(pz5, plist('f1', f1, 'f2', f2, 'nf', nf));
+      out4 = resp(pz5, plist('f1', f1, 'nf', nf2));
+      out5 = resp(pz5, plist('f2', f2));
+
+      mout1 = rebuild(out1);
+      mout2 = rebuild(out2);
+      mout3 = rebuild(out3);
+      mout4 = rebuild(out4);
+      mout5 = rebuild(out5);
+      % </SyntaxCode>
+      stest = true;
+    catch err
+      disp(err.message)
+      stest = false;
+    end
+
+    % <AlgoDescription>
+    %
+    % 1) Check the output
+    % 2) Check that the 'rebuild' method produces the same object as 'out'.
+    %
+    % </AlgoDescription>
+
+    atest = true;
+    T = 10e-12;
+    if stest
+      % <AlgoCode>
+      % Check the output
+      f1d = getlowerFreq(pz5)/10;
+      f2d = getupperFreq(pz5)*10;
+      nfd = find(pzmodel.getInfo('resp', 'Range').plists, 'nf');
+      if ~isa(out1, 'ao'), atest = false; end
+      if ~isa(out2, 'ao'), atest = false; end
+      if ~isa(out3, 'ao'), atest = false; end
+      if ~isa(out4, 'ao'), atest = false; end
+      if ~isa(out5, 'ao'), atest = false; end
+      if out1.x(1)     ~= f1, atest = false; end
+      if any(find(abs(out1.x(end)-f2)>T)), atest = false; end
+      if numel(out1.x) ~= nfd, atest = false; end % Default values
+      if out2.x(1)     ~= f1, atest = false; end
+      if any(find(abs(out2.x(end)-f2)>T)), atest = false; end
+      if numel(out2.x) ~= nf, atest = false; end
+      if out3.x(1)     ~= f1, atest = false; end
+      if abs(out3.x(end)-f2)>T, atest = false; end
+      if numel(out3.x) ~= nf, atest = false; end
+      if out4.x(1)     ~= f1, atest = false; end
+      if out4.x(end)   ~= f2d, atest = false; end % Default values
+      if numel(out4.x) ~= nf2, atest = false; end
+      if out5.x(1)     ~= f1d, atest = false; end % Default values
+      if any(find(abs(out5.x(end)-f2)>T)), atest = false; end
+      if numel(out5.x) ~= nfd, atest = false; end % Default values
+      % Check the rebuilding of the object
+      if ~eq(out1, mout1, ple2), atest = false; end
+      if ~eq(out2, mout2, ple2), atest = false; end
+      if ~eq(out3, mout3, ple2), atest = false; end
+      if ~eq(out4, mout4, ple2), atest = false; end
+      if ~eq(out5, mout5, ple2), atest = false; end
+      % </AlgoCode>
+    else
+      atest = false;
+    end
+
+    % Return a result structure
+    result = utp_prepare_result(atest, stest, dbstack, mfilename);
+  end % END UTP_12
+
+  %% UTP_13
+
+  % <TestDescription>
+  %
+  % Check that the resp method uses the specified f1, f2, and nf to compute the response.
+  %
+  % </TestDescription>
+  function result = utp_13
+
+    % <SyntaxDescription>
+    %
+    % Call the method with different method to pass f1, f2, and nf in.
+    %
+    % </SyntaxDescription>
+
+    try
+      % <SyntaxCode>
+      f1 = .1;
+      f2 = 5;
+      nf = 123;
+      out1 = resp(pz5, plist('f1', f1, 'f2', f2, 'nf', nf, 'scale', 'lin'));
+      out2 = resp(pz5, plist('f1', f1, 'f2', f2, 'nf', nf, 'scale', 'log'));
+      out3 = resp(pz5, plist('scale', 'lin'));
+      out4 = resp(pz5, plist('scale', 'log'));
+
+      mout1 = rebuild(out1);
+      mout2 = rebuild(out2);
+      mout3 = rebuild(out3);
+      mout4 = rebuild(out4);
+      % </SyntaxCode>
+      stest = true;
+    catch err
+      disp(err.message)
+      stest = false;
+    end
+
+    % <AlgoDescription>
+    %
+    % 1) Check the output
+    % 2) Check that the 'rebuild' method produces the same object as 'out'.
+    %
+    % </AlgoDescription>
+
+    atest = true;
+    T = 10e-12;
+    if stest
+      % <AlgoCode>
+      % Check the output
+      f1d = getlowerFreq(pz5)/10;
+      f2d = getupperFreq(pz5)*10;
+      nfd = find(pzmodel.getInfo('resp', 'Range').plists, 'nf');
+      if ~isa(out1, 'ao'), atest = false; end
+      if ~isa(out2, 'ao'), atest = false; end
+      if ~isa(out3, 'ao'), atest = false; end
+      if ~isa(out4, 'ao'), atest = false; end
+      xlin1 = linspace(f1, f2, nf);
+      xlin2 = linspace(f1d, f2d, nfd);
+      xlog1 = logspace(log10(f1), log10(f2), nf);
+      xlog2 = logspace(log10(f1d), log10(f2d), nfd);
+      if ~isequal(xlin1, out1.x'), atest = false; end
+      if ~isequal(xlin2, out3.x'), atest = false; end
+      if ~isequal(xlog1, out2.x'), atest = false; end
+      if ~isequal(xlog2, out4.x'), atest = false; end
+
+      % Check the rebuilding of the object
+      if ~eq(out1, mout1, ple2), atest = false; end
+      if ~eq(out2, mout2, ple2), atest = false; end
+      if ~eq(out3, mout3, ple2), atest = false; end
+      if ~eq(out4, mout4, ple2), atest = false; end
+      % </AlgoCode>
+    else
+      atest = false;
+    end
+
+    % Return a result structure
+    result = utp_prepare_result(atest, stest, dbstack, mfilename);
+  end % END UTP_13
+
+end