function [out, Elist]=sd(W,Nit)
Input:
Output:
Generalize your function in ``sd.m'' to provide the above functionality. It practice, you can accomplish this by including ``Elist'' in the function prototype at the top of the file and adding the two indicated statements to your loop as in the example below.
% Minimization with steepest descent algorithm using getE() and getgrad()
%
% Usage: [out, Elist]=sd(W,Nit)
function [out, Elist]=sd(W,Nit)
.
.
.
for it=1:Nit
out=out-alpha*getgrad(out);
Elist(it)=getE(out); %# <= New statements
Elist(it)
end
.
.
.