How to pass multiple arguments to a function stored in a vector?
Mostrar comentarios más antiguos
Hello guys;
I'm making a program for my college assignment and I got stuck in a situation. So, I have a vector X storing x1,x2,x3....xn (i.e. X = [x1,x2,x3,...xn] ) and a function f(x1,x2,x3,...xn). e.g. let f(x1,x2) = sin(x1)+cos(x2) and X = [1,2]. So I want to write a code which accepts the values stored in X (i.e. x1 and x2 in this given example) and use them for function arguments (i.e. f(x1,x2) = f(1,2) = sin(1)+cos(2)).
2 comentarios
KALYAN ACHARJYA
el 26 de Nov. de 2020
X=[......]
Pass the entire vector
function out_put_arguments=fun1(X)
.........
end
If I don't understand the question, pleas can you provide more with the sample example.
abhisek singh
el 27 de Nov. de 2020
Editada: abhisek singh
el 27 de Nov. de 2020
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Functions 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!

