change variable in function_handle
17 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
saeed rezaei
il 19 Mag 2021
Commentato: saeed rezaei
il 19 Mag 2021
hello all,
i wanna to change x in f=@(x)sinx to x+2 so that we have g=(x)sin(x+2)
how can i derive g from f in matlab?
thanks alot
0 Commenti
Risposta accettata
the cyclist
il 19 Mag 2021
I think this is what you mean?
% Define f
f=@(x) sin(x);
% Derive g from f
g = @(x) f(x+2);
% Show that it gives expected result
f(2)
g(0)
Più risposte (1)
Vedere anche
Categorie
Scopri di più su Logical in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!