How to extract values from a function handle in the prompt
조회 수: 5 (최근 30일)
이전 댓글 표시
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?
댓글 수: 0
채택된 답변
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
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개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!