MATLAB: Subtracting two function handles

function handlesnested functionssubfunctions

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)

Best Answer

h=@(x) f(x)-g(x);