checkpi.m

来自「RBF网络逼近、RBF-建模、RBF网络训练与测试程序」· M 代码 · 共 57 行

M
57
字号
function [err,pi] = checkpi(net,pi,Q)
%CHECKPI Check Pi dimensions.
%
%  Synopsis
%
%    [err,pi] = checkpi(net,Pi,Q)
%
%  Warning!!
%
%    This function may be altered or removed in future
%    releases of the Neural Network Toolbox. We recommend
%    you do not write code dependant on this function.

%  Mark Beale, 11-31-97
%  Copyright 1992-2002 The MathWorks, Inc.
% $Revision: 1.8 $

err = [];

% [] -> zeros
if any(size(pi) == 0)
  c = cell(net.numInputs,net.numInputDelays);
  for i=1:net.numInputs
    for ts=1:net.numInputDelays
    c{i,ts} = zeros(net.inputs{i}.size,Q);
  end
  end
  pi = c;
  return
end

% Check cell array dimensions
if (size(pi,1) ~= net.numInputs)
  err = sprintf('Input states are incorrectly sized for network.\nCell array must have %g rows.',net.numInputs);
  return
end
if (size(pi,2) ~= net.numInputDelays)
  err = sprintf('Input states are incorrectly sized for network.\nCell array must have %g columns.',net.numInputDelays);
  return
end

% Check element dimensions
for i=1:net.numInputs
  rows = net.hint.inputSizes(i);
  for j=1:net.numInputDelays
    if (size(pi{i,j},1) ~= rows)
    err = sprintf('Input states are incorrectly sized for network.\nMatrices must all have %g rows.',rows);
    return
  end
    if (size(pi{i,j},2) ~= Q)
    err = sprintf('Input states are not consistently sized.\nMatrices must all have the same numbers of columns.');
    return
  end
  end
end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?