How to define a multivariable function (for instance an anonymous function) of a number of variables that varies according to the size of an array variable?

My aim is to compute the point of minimum value for a function which is a determinant of the product of 3 matrices where the columns of the first and third are functions of a variable each.

 Respuesta aceptada

Thorsten
Thorsten el 10 de Sept. de 2015
Editada: Thorsten el 10 de Sept. de 2015
Define your function as
function y = myfun(a,b)
A = [-a a; a -a]; % sample definition
B = rand(2);
C = [-2*b b; -4*b b]
y=det(A*B*C)
Use fminsearch to find the minimum of that function.

1 comentario

Thank you so much for your effort. The problem with this answer is that the number of variables on the call to the function is 2 but in my case is p which is the size of the matrice of data. It's not possible to call the function with x1,x2,...,xp. Do you have any idea of how to circumvent this?

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Preguntada:

el 10 de Sept. de 2015

Comentada:

el 10 de Sept. de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by