How to extract values from a function handle in the prompt

5 ビュー (過去 30 日間)
Avishek Mukherjee
Avishek Mukherjee 2021 年 8 月 8 日
コメント済み: Walter Roberson 2021 年 8 月 11 日
Here is my code:
C1 = chebfun('exp(1i*t)*(2.4633+0.2865*cos(t)-0.2930*sin(t)-0.0378*cos(2*t)-0.0161*sin(2*t)-0.1422*cos(3*t)+0.0078*sin(3*t)-0.0418*cos(4*t)-0.0569*sin(4*t))',[0 2*pi],'trig');
C2 = chebfun('exp(1i*t)*(1.7133+0.2797*cos(t)-0.2480*sin(t)+0.0295*cos(2*t)+0.0460*sin(2*t)-0.1987*cos(3*t)+0.0309*sin(3*t)-0.0017*cos(4*t)+0.0471*sin(4*t))',[0 2*pi],'trig');
[finv]= conformal2(C1,C2,'poly', 'plots');
When I execute the commands and type in finv in the prompt to get my inverse function, the result is:
finv =
function_handle with value:
@(zz)reval(zz,z,f,w)
My question is how to extract finv from the above function handle?

採用された回答

Walter Roberson
Walter Roberson 2021 年 8 月 9 日
info = functions(finv);
ws = info.workspace{1};
ws.z
ws.f
ws.w
That will show you the variables that were "captured" in the function handle. It will not, however, necessarily show you anything recognizable as a formula.
  10 件のコメント
Walter Roberson
Walter Roberson 2021 年 8 月 11 日
Walter Roberson
Walter Roberson 2021 年 8 月 11 日
But I am suspecting that it is a different function handle that is involved. You were at the command prompt, so if it was Z that the error message was about, then you would not have received a traceback line. I suspect Z([]) is going to show the error as well.
You should debug,
dbstop if error
Z([])
and see where it stops. For example perhaps at the location indicated, it is expecting r1 and r2 to be numeric, but instead one of them is a function handle.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeWord games についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by