Fminsearch for matrices

4 visualizaciones (últimos 30 días)
srinadh
srinadh el 21 de Abr. de 2011
Hi, how can i use fminsearch function for more than one dimension.
I am trying to do some thing like f=@(X)min(A-B*X), where A and B are given matrices. When I try to do fminsearch(f,x) i get the following error
??? Error using ==> minus Matrix dimensions must agree
so is there a way? Thanks

Respuesta aceptada

Andrew Newell
Andrew Newell el 21 de Abr. de 2011
It sounds like the problem is with the dimensions of B*X. Does your initial value x0 have the same dimensions as A and B?
  4 comentarios
Andrew Newell
Andrew Newell el 21 de Abr. de 2011
Ah, I see the problem. FMINSEARCH can only accept functions that have a scalar as output. Fortunately, the function with the norm in it seems to be what you want.
srinadh
srinadh el 21 de Abr. de 2011
Oh, that's the issue. Thanks for the help :)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Get Started with MATLAB en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by