You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
607 B
Matlab

function [y,e,r,ytrace]=dim_activation(W,X,y)
epsilon1=1e-6;
epsilon2=1e-3;
iterations=75;
[n,m]=size(W);
if nargin<3 || isempty(y)
y=zeros(n,1,'single'); %initialise prediction neuron outputs
end
%set feedback weights equal to feedforward weights normalized by maximum value
V=bsxfun(@rdivide,abs(W),max(1e-6,max(abs(W),[],2)));
%V=bsxfun(@rdivide,W,max(1e-6,max(W,[],2)));
V=V'; %avoid having to take transpose at each iteration
for t=1:iterations
x=(X(:,min(t,size(X,2))));
%update responses
r=V*y;
e=x./max(epsilon2,r);
y=max(epsilon1,y).*(W*e);
if nargout>3, ytrace(:,t)=y; end
end