Subtracting two function handles

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)

 Respuesta aceptada

Matt J
Matt J el 19 de Nov. de 2012
h=@(x) f(x)-g(x);

Más respuestas (0)

Categorías

Más información sobre Function Handles en Centro de ayuda y File Exchange.

Preguntada:

Joe
el 19 de Nov. de 2012

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by