How to extract values from a function handle in the prompt

5 Ansichten (letzte 30 Tage)
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?

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 9 Aug. 2021
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 Kommentare
Walter Roberson
Walter Roberson am 11 Aug. 2021
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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Word games finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by