function plotcentered( nsteps, params, response, data )
%plotcentered( nsteps, params, response, data )
%
%  Description:
%
%    Generate a centered parameter study plot for each of the response
%    variables.
%
%  Inputs:
%
%    nsteps   = number of steps in the study
%                 - see steps_per_variable in the Dakota input file
%    params   = cell vector of the parameter names
%    response = cell vector of the response variable names
%    data     = the params/response data from the tabular.dat file
%                  - use readtabular.m to parse the data
%
%  Contact:
%
%    Bob Cochran
%    Applied CHT
%    rjc@heattransfer.org
%
%  History:
%
%    Who    Date   Version  Note
%    ---  -------- -------  -----------------------------------------------
%    RJC  05/16/17  0.1.0   Initial release.
%
%==========================================================================

npar = length(params);     % number of parameters
nresp = length(response);  % number of repsonses
steps = [-nsteps:1:nsteps];

for i=1:nresp   % for each response in the data
  for j=1:npar  % for each parameter in the study
    row = 2 + (j-1)*2*nsteps;
    pdat(j,:) = data([row:row+nsteps-1, 1, row+nsteps:row+nsteps+nsteps-1], i+npar);
  end
  figure(i)
  hold
  for k=1:npar
    plot(steps, pdat(k,:))
  end
  xlabel('parameter step')
  ylabel(response{i})
  legend(params)
end

