Borrar filtros
Borrar filtros

How can I express a symbolic variable in function of other symbolic variables,

8 visualizaciones (últimos 30 días)
hello
is there a predefined function in matlab that can express a symbolic variable depending on other symbolic variables, for example
syms x y z
z=x^2+y^3;
x=f(y,z)=?????????????????
what is a function that allows to write x in terms of y and z
thanks in advance
  1 comentario
Sean de Wolski
Sean de Wolski el 25 de Nov. de 2013
Like a function in a separate file that takes in x and y or like your expression for z which could be rewritten as
z = @(x,y)x^2+y^2;
Then to use:
z(x,y)

Iniciar sesión para comentar.

Respuesta aceptada

Walter Roberson
Walter Roberson el 25 de Nov. de 2013
With newer MATLAB versions, you can use
syms f(y,z)
f(y,z) = x^2+y^3;
  4 comentarios
XAXRXTX
XAXRXTX el 30 de Nov. de 2013
Editada: XAXRXTX el 30 de Nov. de 2013
thanks walter, it works but you must add a quotes
syms x y z
X = solve('z = x^2+y^3', x);
Walter Roberson
Walter Roberson el 1 de Dic. de 2013
Whether quotes are needed or not depends on the MATLAB version.

Iniciar sesión para comentar.

Más respuestas (1)

Andrei Bobrov
Andrei Bobrov el 29 de Nov. de 2013
Editada: Andrei Bobrov el 29 de Nov. de 2013
syms x y z
xfun = matlabFunction(solve(x^2+y^3 == z,x))
  3 comentarios
XAXRXTX
XAXRXTX el 30 de Nov. de 2013
thanks again andrei, but you must add a quotes and eliminate =
syms x y z
xfun = matlabFunction(solve('x^2+y^3 = z',x))

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by