Apply a function array to an array of numbers - MATLAB Cody - MATLAB Central

Problem 1196. Apply a function array to an array of numbers

Difficulty:Rate

It is required to apply a cell array of functions to a numerical array, where the functions accept only scalar inputs.

Example:

>> f{1} = @(x) x;

>> f{2} = @(x) x^2;

>> f{3} = @(x) x^3;

>> x = 1:5;

>> arfn(f,x)

ans =

     1     2     3     4     5
     1     4     9    16    25
     1     8    27    64   125

Solution Stats

53.3% Correct | 46.7% Incorrect
Last Solution submitted on Apr 11, 2025

Problem Comments

Solution Comments

Show comments
Why should you share code?
In a discussion on LInkedin about my recent blog post, Do these...
3
6

Problem Recent Solvers94

Suggested Problems

More from this Author11

Community Treasure Hunt

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

Start Hunting!