How to create a dynamic function handle?
조회 수: 8 (최근 30일)
이전 댓글 표시
I want to create a dynamic function handle. How to do?
댓글 수: 1
John D'Errico
2022년 11월 22일
What is a dynamic function handle? If you want a useful answer, you need to ask a clear question.
답변 (1개)
Star Strider
2022년 11월 22일
I have no idea what you are asking.
It is straightforward to create a function handle that accepts various function arguments, either for a specific function or an existing function.
f = @(x,y) exp(-(x.^2 + y.^2)/5);
[X,Y] = ndgrid(-5:0.1:5);
figure
surf(X, Y, f(X,Y))
grid on
.
댓글 수: 2
Star Strider
2022년 11월 22일
Create the functions you want, then use an if, elseif, else block to choose the function to execute with respect to a particular condition.
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!