A question on minimizing a composition function with multiple variables how to min g(f(x), k(x),w(x))?
Mostrar comentarios más antiguos
hi, all my main question is whether i can have g=@x (f(x),y(x),k(x)) solved? where f(x),y(x),k(x) being a function of x(1),x(2),x(3),x(4),x(5)
here is the question, if i make g only compose one of the function above it is working. with g=@x expression with only variable x
However, if i want g to be a function of f, y, k, w, i would see error on "too many input arguments".
Any ideas? Or how to use it properly?
Respuestas (1)
Andrew Newell
el 20 de Feb. de 2011
It's just the use of round parentheses to gather the variables. Is this what you're trying to do?
f = @(x) x;
k = @(x) x.^2;
w = @(x) x.^3;
g = @(x) [f(x) k(x) w(x)];
x = (1:5)';
g(x)
Categorías
Más información sobre NaNs en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!