How to pass a function handle if some input argument is fixed?
조회 수: 9 (최근 30일)
이전 댓글 표시
I have to pass a function handle of a single variable function, but I want to use a function with multiple input arguments, and fix some of them. For example I want to pass the handle of single variable function: normpdf(x,10,2).
댓글 수: 0
답변 (1개)
Walter Roberson
2017년 5월 20일
For example,
target = 0.16193;
myfun = @(x) normpdf(x, 10, 2) - target;
fzero(myfun, rand) %example of needing to pass a function of one variable
댓글 수: 2
Stephen23
2017년 5월 22일
"is it possible to do this in one line?"
Why not try it yourself?:
fzero(@(x)normpdf(x,10,2)-target, rand)
참고 항목
카테고리
Help Center 및 File Exchange에서 Parallel Computing Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!