How to pass a function handle if some input argument is fixed?
11 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Walter Roberson
le 20 Mai 2017
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 commentaires
Stephen23
le 22 Mai 2017
"is it possible to do this in one line?"
Why not try it yourself?:
fzero(@(x)normpdf(x,10,2)-target, rand)
Voir également
Catégories
En savoir plus sur Data Import from MATLAB dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!