我先把代码贴过来!慢慢研究!
function [out1,out2] = learnp(varargin)
%LEARNP Perceptron weight/bias learning function.
%
% <a href="matlab:doc learnp">learnp</a> is the perceptron weight/bias learning function.
%
% <a href="matlab:doc learnp">learnp</a>(W,P,Z,N,A,T,E,gW,gA,D,LP,LS) takes several inputs,
% W - SxR weight matrix (or b, an Sx1 bias vector).
% P - RxQ input vectors (or ones(1,Q)).
% Z - SxQ weighted input vectors.
% N - SxQ net input vectors.
% A - SxQ output vectors.
% T - SxQ layer target vectors.
% E - SxQ layer error vectors.
% gW - SxR gradient with respect to performance.
% gA - SxQ output gradient with respect to performance.
% D - SxS neuron distances.
% LP - Learning parameters, none, LP = [].
% LS - Learning state, initially should be = [].
% and returns,
% dW - SxR weight (or bias) change matrix.
% LS