minimizing a function with matrix output

4 次查看(过去 30 天)
Dear all, I have this function:
function f=obj(C1,C2,H12,H21,F1,F2)
f=norm(H12*F2-C1*C1'*H12*F2)^2+norm(H21*F1-C2*C2'*H21*F1)^2;
H12 and H21 are 3x3 matrix, F1 and F2 are 3x1 matrix. I want to minimize the function to find C1 and C2, but C1 and C2 should be a 3x1 matrix. I tried fminsearch and other function but as I read in the "help", it only results in scalar. Do you have any idea to minimize this function to get matrix result?
Thank you!

采纳的回答

Jos (10584)
Jos (10584) 2014-2-16
You can define an error function that you minimise with fminsearch. The function obj and the arguments H12, H21, F1 and F2 should be defined beforehand. The free parameters C1 and C2 are put together in a single free parameter P. The error function errfun should return a scalar.
ErrorFun = @(P) obj(P(:,1), P(:,2), H12, H21, F1, F2)
Pinit = rand(3,2) ; % or maybe there are better initial estimates for C1 and C2?
Pout = fminsearch(ErrorFun, Pinit)
C1 = Pout(:,1)
C2 = Pout(:,2)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Mathematics 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by