Adding functions of the same variable to form a new function

16 views (last 30 days)
Basically. Say I have two functions like:
f1= @(x)(43*(x^3)+32)
f2 = @(x) (34+9*x - 2*(x^2))
How do I combinde these functions together in matlab
f3= f1+f2
does not do it.

Accepted Answer

Stephen23
Stephen23 on 15 Dec 2017
Edited: Stephen23 on 15 Dec 2017
To add normal MATLAB functions simply define a new function:
f3 = @(x) f1(x) + f2(x);
  1 Comment
Guster
Guster on 15 Dec 2017
Edited: Guster on 15 Dec 2017
Thanks, I couldnt Google it since I didnt know the name was actually function_handle

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!