matlab function
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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!
0 comentarios
Respuesta aceptada
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.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!