Borrar filtros
Borrar filtros

matlab function

2 visualizaciones (últimos 30 días)
LIU WEIHUA
LIU WEIHUA el 26 de Mzo. de 2012
when I use the function below:
syms x y z
f = [x*y*z; y; x + z];
v = [x, y, z];
R = jacobian(f, v);
the result is :
R =
[ y*z, x*z, x*y]
[ 0, 1, 0]
[ 1, 0, 1];
However, I want to assign the real number to x y z, for example, x=1 y=2 z=3 , and get the real value of the R.How can I do this?
Thank you very much!

Respuesta aceptada

Walter Roberson
Walter Roberson el 26 de Mzo. de 2012
When you say "real value of R", do you mean as opposed to the imaginary part? If so, then use real (R) -- but don't expect the output to change much.
If when you say "real value of R", you are talking about the R that would result for particular values of x, y, and z, then you can subs() values in to R:
subs(R, {x, y}, {11.3, pi/42})
But if you are evaluating repeatedly you might want to use matlabFunction:
Rf = matlabFunction(R, x, y, z);
Then Rf would be a function handle that would accept 3 parameters and return the appropriate matrix.

Más respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by