Write a function that accepts two function handles f and g and returns the composition h. That is,

h = (f o g)(x) = f(g(x))

Example:

>> f = @(x)x^2;
>> g = @(x)x+1;
>> h = composeFcn(f,g);
>> h(3)
ans =
  16

because (3+1)^2 = 16.

Solution Stats

627 Solutions

261 Solvers

Last Solution submitted on Apr 02, 2026

Last 200 Solutions

Problem Comments

Solution Comments

Show comments
Loading...

Group


Problem Recent Solvers261

Problem Tags

Community Treasure Hunt

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

Start Hunting!