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) )

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by