Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

Subtracting two function handles

Asked by Joe

Joe (view profile)

on 19 Nov 2012
Accepted Answer by Matt J

Matt J (view profile)

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)

0 Comments

Joe

Joe (view profile)

Products

No products are associated with this question.

1 Answer

Answer by Matt J

Matt J (view profile)

on 19 Nov 2012
Accepted answer
 h=@(x) f(x)-g(x);

1 Comment

Joe

Joe (view profile)

on 19 Nov 2012

Thank you so much!

Matt J

Matt J (view profile)

Contact us