How to modify a function handle?
11 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Koki
le 16 Mai 2021
Réponse apportée : per isakson
le 16 Mai 2021
Sorry I am not sure how to phrase the question but say I had a function handle say: myfun1 = @(y) y
Would I be able to modify that function and say something like myfun2 = @(y) myfun1*2
So when I write myfun2(5) it will return 10.
I essentially want to perform arithmetic on expressions representing functions of x to obtain other functions of x.
0 commentaires
Réponse acceptée
per isakson
le 16 Mai 2021
That's simpler than you thought
%%
f1 = @(y) y;
f2 = @(y) f1(y)*2;
%%
f2(5)
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Loops and Conditional Statements 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!