Minimize the sum of a function, changing variables from a different function
이전 댓글 표시
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
Walter Roberson
2012년 5월 5일
Which variables need to be changed during the minimization process?
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Function Creation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!