MATLAB: Different Result of Analytical and Trained ANN Recurrent Neural Network

ann ; analytical ;

Hi All,
I have question regarding to my analytical equation vs trained ANN (Recurrent Neural Network) with 5 input and 1 output. From my trained ANN, I obtain IW, LW, and b to create analytical ANN equation. The function of this equation is shown below :
============================================================================================================
function answer = ANN(u,t) ;
global netc
[IW] = netc.IW{1,1} ; [LW1] = netc.LW{1,1} ; [LW2] = netc.LW{2,1} ; [b1] = netc.b{1,1} ; [b2] = netc.b{2,1} ;
a0 = zeros(20,1) ; a1(:,1) = tanh(IW*u + LW1*a0 + b1) ; a2(1) = LW2*a1(:,1) + b2 ;
for t = 1:(t-1) ; a1(:,t+1) = tanh(IW*u + LW1*a1(:,t) + b1) ; a2(t) = LW2*a1(:,t) + b2 ; end
answer = a2(end,end) ; ============================================================================================================
However, the curve produce by this analytical method is different even though the trend looks similar. The comparison between this two curves shown below :
NOTE : Blue = Trained ANN / Red = Analytical Equation
I want to ask are there something wrong with my analytical equation? Please advise.
Regards,
HKT

Best Answer

You forgot that the MATLAB variables are automatically normalized before training and denormalized after training.
Try searching in both the NEWSGROUP and ANSWERS using
greg analytic
Hope this helps
Thank you for formally accepting my answer
Greg