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);

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Function 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