intermediate variables influnences in a for loop of MATLAB code
1 view (last 30 days)
Show older comments
Hi everyone,
I have a problem about intermediate varaibles in a for loop. It's part of MLP code, for simplicity I don't write it down here. In the last section of the for loop, it is
W1Ex=W1Ex+lr*dW1Ex;
W2Ex=W2Ex+lr*dW2Ex;
W2=W2Ex(:,1:HiddenUnitNum);
end
And now I want to add intermediate varaibles as
W1_2Ex=W1Ex+lr*dW1Ex;
W2_2Ex=W2Ex+lr*dW2Ex;
W2=W2_2Ex(:,1:HiddenUnitNum);
W1Ex=W1_2Ex;
W2Ex=W2_2Ex;
end
And Since W1_2Ex and W2_2Ex only exist in this part, the rest of the loop remain the same. I don't know why the simulation under these two scenarios are different. Actually, the changed one did not converge. Moreover, when I switch back to the orignal code(without intermediate varaibles). The results are wrong too and I have to restart MATLAB to run it again to get the right answer! Could someone give me some hints!
0 Comments
Answers (0)
See Also
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!