Mugen
Mugen

Reputation: 9085

MATLAB: Apply input vector to a vector of functions

Say I have the following definitions:

syms x y z
F = [x^2+y^2+z^2-1; 2*x^2+y^2-4*z; 3*x^2-4*y+z^2];
v = [x, y, z];

I want to evaluate F(x=1, y=2, z=3), meaning apply the stored functions to the input.

Alternatively, I could use function handlers for every member of F, but then I couldn't easily calculate the jacobian:

J = jacobian(F, v)

How can it be done?

Upvotes: 0

Views: 48

Answers (1)

user3049442
user3049442

Reputation: 74

To evaluate F for some specific values you can use

subs(F,{x y z},{1 2 3})

Upvotes: 2

Related Questions