How to see the content of a function handle?

2 ビュー (過去 30 日間)
rasoul rad
rasoul rad 2016 年 12 月 22 日
コメント済み: rasoul rad 2016 年 12 月 22 日
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.

採用された回答

Walter Roberson
Walter Roberson 2016 年 12 月 22 日
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) )
  1 件のコメント
rasoul rad
rasoul rad 2016 年 12 月 22 日
Perfect answer. Thank you.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by