Subtracting two function handles

43 views (last 30 days)
Joe
Joe on 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)

Accepted Answer

Matt J
Matt J on 19 Nov 2012
h=@(x) f(x)-g(x);

More Answers (0)

Categories

Find more on Function Creation in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!