MATLAB: How to convert this to r2013 a code

Deep Learning Toolboxneural network

how to convert this to r2013 a code:
clear tempP
for k = 1:500,
P = [theta(k);psi(k);theta_dot(k);psi_dot(k)];
tempP = [tempP P];
end
net= newff([-2 2;-2 2;-2 2;-2 2],[50 1],{'tansig','purelin'},'trainlm');
net.trainParam.epochs = 500;
net = train(net,tempP,out(1:500)');

Best Answer

1. This is MATLAB, a MATtrix LAnguage. Typically, loops are unnecessary. If theta, etc are row vectors, use
P = [ theta; psi; theta_dot; psi_dot];
otherwise transpose them before forming P.
2. The target should neither be named out nor should it be a column vector. It should be a row vector named Target or T
[ I N ] = size(P); % [ 4 500 ]
[ O N ] = size(T); % [ 1 500 ]
3. The input syntax you used with NEWFF is DOUBLY obsolete; i.e.,
net = net( minmax(P), [ H O ]);
where the remaining 3 inputs were OMITTED since they are defaults.
4. This newer version is also obsolete:
net = net( P, T, H);
5. NEWFIT (regression)and NEWPR (classification) automatically call NEWFF; ALL are obsolete and have been replaced by FITNET(regression), PATTERNNET(classification) and FEEDFORWARDNET, respectively.
6. To find the correct syntax for your regression problem use the commands
help fitnet
doc fitnet
7. For oogobs of examples, search both the NEWSGROUP and ANSWERS using
greg fitnet.
Hope this helps.
Thank you for formerly accepting my answer
Greg