minimizing a function with matrix output
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Mei Li
el 16 de Feb. de 2014
Comentada: Mei Li
el 16 de Feb. de 2014
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!
0 comentarios
Respuesta aceptada
Jos (10584)
el 16 de Feb. de 2014
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)
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!