How to input a vector into a multi variable function as individual components?
4 views (last 30 days)
Show older comments
Timothy Corley
on 28 Nov 2017
Commented: Timothy Corley
on 28 Nov 2017
This top part will be the input of my function and this part cannot be manipulated.
F = @(x1,x2) [(4*x1^2 - 20*x1 + x2^2/4 + 8) ; (x1*x2/2 + 2*x1 - 5*x2 + 8)];
x0 = [0 ; 0];
What I want to do is evaluate the function at F(x0(1),x0(2)) (for this example) and have it output the solution. But to keep it general let's say
i = nargin(F)
for n = 1:i
F(x0(1),x0(2),x0(...),x0(n))
end
not real and it's definitely ghetto code but hopefully shows you what I'd like to do. I'm looking for a way to evaluate F composed of the individual components of x0 basically.
Also, x0 will always be a column vector with the length equal to the number of inputs in F.
The solution for what I want in the above example is: F(0,0) = [8 ; 8]
Hopefully this makes sense... Any advice would be greatly appreciated!
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Develop Apps Using App Designer in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!