Subtracting two function handles

12 次查看(过去 30 天)
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)

采纳的回答

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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Search Path 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by