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)

 採用された回答

Matt J
Matt J 2012 年 11 月 19 日

0 投票

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

1 件のコメント

Joe
Joe 2012 年 11 月 19 日
Thank you so much!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeFunction Handles についてさらに検索

質問済み:

Joe
2012 年 11 月 19 日

Community Treasure Hunt

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

Start Hunting!

Translated by