I don't have so much experience in working with Matlab, so I hope that you could help with some details.
I downloaded a code from mathworks for training mlp nn using extended kalman filter.
<code>
function [theta,P,e]=nnekf(theta,P,x,y,Q,R)
%f=@(u)u;
%h=@(u)nn(u,x,size(y,1));
[theta,P]=ekf(f,theta,P,h,y(:),Q,R);
e=h(theta);
% The NN model. It can be modified for different NN structure.
function y=nn(theta,x,ny)
[nx,N]=size(x);
ns=numel(theta);
nh=(ns-ny)/(nx+ny+1);
W1=reshape(theta(1:nh*(nx+1)),nh,[]);
W2=reshape(theta(nh*(nx+1)+1:end),ny,[]);
y=W2(:,1:nh)*tanh(W1(:,1:nx)*x+W1(:,nx+ones(1,N)))+W2(:,nh+ones(1,N));
y=y(:);
</code>
My problem is that I'm using Matlab, version 6.5, so in first 2 lines I receive an error: "identifier" expected, "(" found.
How can I change it, so that it works in version 6.5?
I appreciate your help
f=@(u)u;
h=@(u)nn(u,x,size(y,1));
And there is where the error appears. Can somebody help me now?
Anonymous functions, which is what these statements create, are
available starting in MATLAB 7.
--
Loren
http://blogs.mathworks.com/loren