I will explain my problem. My code is given below.
% ********************* Plant ************************
s = 5000; u = zeros(1, s); y = zeros(1, s); yhat = zeros(1, s);for k=1:s u(k)= unifrnd(-1,1); if (k==1), y(k)=0; elseif (k==2), y(k)=0.3*y(k-1)+u(k)+0.3*u(k); else y(k)=0.3*y(k-1)+0.6*y(k-2)+u(k)+0.3*u(k); end end
% **************** NN Modelling ********************* % Creating Neural Net
[yn,ys] = mapminmax(y); net = newcf( u, yn, [20 10 ], 'tansig', 'tansig',... 'purelin'},'trainscg');% Training Neural Net
net.trainParam.lr = 0.05; net.trainParam.lr_inc =1.05; net.trainParam.lr_dec = 0.7; net.trainParam.hide = 50; net.trainParam.mc = 0.9; net.trainParam.epochs = s; net.trainParam.goal = 1e-5; net.trainParam.max_fail = s; net.trainParam.time = 3*3600; trainInd = 1:1:s; valInd = 2:50:s; testInd = 3:50:s; [trainu,valu,testu] = divideind,u,trainInd,valInd,testInd); [trainy,valy,testy] = divideind(yn,trainInd,valInd,testInd); net = init(net); net = train(net,u,yn);
The actual problem is different. The above program is written in an m-file and takes about 15 minutes to converge. Can you go through the program and tell me if I am correct in programming? I wish to use this net for another set of inputs. For this, I need to access the trained net. How the trained net is saved external to this m file and how to access it? Please help. Thanks in advance.
Best Answer