Minimize the sum of a function, changing variables from a different function
Ältere Kommentare anzeigen
Hi everyone,
I'm quite new to Matlab so please excuse the errors and minor problems in the code. I'm trying to perform a simple minimization of a sum of a llf, which has its inputs from a different function, and this last one is where I want the variables to change to find the minimum of the sum of llf. I have a simple vector of returns, and everything should be handled for the length of that vector.
ret %is the vector of returns
e_2=(ret-mean(ret)).^2;
t=length(e_2);
a=zeros(t,1);
x=v(1);
y=v(2);
z=v(3);
for ii=2:t
a(ii)=x+y*e_2(ii-1)+z*a(ii-1);
end
for k=1:t
mle_est(k)=((0.5*(e_2(k)/a(k)))+log(a(k).^0.5));
end
llf=sum(mle_est)
And now I would like to minimize this sum. I understand I could do this with an inline function (handle function), but since the variables I want will not be directly in the inline function, how could I handle this? Help please?
Thanks a lot!
1 Kommentar
Walter Roberson
am 5 Mai 2012
Which variables need to be changed during the minimization process?
Antworten (0)
Kategorien
Mehr zu Function Creation finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!