How to see the content of a function handle?

2 visualizaciones (últimos 30 días)
rasoul rad
rasoul rad el 22 de Dic. de 2016
Comentada: rasoul rad el 22 de Dic. de 2016
Hi, I'm trying to create a function handle with 2 variables like x(1) and x(2) and use this function into next command lines to create other functions. for example assume these lines:
Dh = @(x) ((4*x(1)))/((x(1)+sin(x)));
G = @(x) (1/(10*x(1)));
Re = @(x) ((G(x)*Dh(x)));
Now, if i want to see the content of variable "Re", the MATLAB will answer like this:
>> Re
Re =
function_handle with value:
@(x)((G(x)*Dh(x)))
I want to see "Re" in mathematic shape like this:
4
----------------
10 x + 10 sin(x)
How can i do this? I'll be grateful for any help.

Respuesta aceptada

Walter Roberson
Walter Roberson el 22 de Dic. de 2016
You would need the symbolic toolbox.
Dh = @(x) ((4*x(1)))./((x(1)+sin(x))); %note correction to use ./ instead of /
G = @(x) (1/(10*x(1)));
Re = @(x) ((G(x)*Dh(x)));
x = sym('x', [1 2]);
pretty( Re(x) )

Más respuestas (0)

Categorías

Más información sobre Get Started with MATLAB 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