How to see the content of a function handle?

2 visualizzazioni (ultimi 30 giorni)
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.

Risposta accettata

Walter Roberson
Walter Roberson il 22 Dic 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) )

Più risposte (0)

Categorie

Scopri di più su Get Started with MATLAB in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by