Subtracting two function handles

13 vues (au cours des 30 derniers jours)
Joe
Joe le 19 Nov 2012
I was wondering how I could subtract values from two anonymous functions to yield a new function handle. for example:
f = @sin
g = @cos
and I want to define
h = f - g, such that h = @(sin - cos)

Réponse acceptée

Matt J
Matt J le 19 Nov 2012
h=@(x) f(x)-g(x);
  1 commentaire
Joe
Joe le 19 Nov 2012
Thank you so much!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Function Handles 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!

Translated by