# MATLAB: I cannot create a function handle composed of a sum of function handles in a cell with a vector input

cellcellfunfunction handleMATLABsumsummation

For the following test function, I would like to sum up function handles which are allocated in a cell. This summation must be a function handle of it own, such that i can insert a vectorial input. For this purpose, I tried the following:
clear; close all; clcx=0:0.01:pi;            %Input vectorn=5;                    %orderm=0:n;                  %Positive modes%My example functiony=cell(length(m),1);for k=1:length(m)y{k}=@(arg) sin(m(k)*arg);endy=reshape(y,[1,length(m)]);figure(1)hold onfor k=1:length(m)plot(x,y{k}(x));endhold offxlim([x(1) x(end)])grid on%Summation of function handles y%Here the error starts to occurysum=@(x) sum(cellfun(@(F) F(arg),y));figure(2)plot(x,ysum(x))xlim([x(1) x(end)])grid on
I hope somebody is able to help me out with this one. Eventually i have to apply something similar to another code but with more complexity. Thanks in advance!

x = 0:0.01:pi;            %Input vectorn = 5;                    %orderm = 0:n;                  %Positive modes%My example functiony = cell(1,numel(m));for k = 1:numel(m)    y{k} = @(arg) sin(m(k)*arg);endfigure(1)hold onfor k = 1:numel(m)    plot(x,y{k}(x))endhold offxlim(x([1,end]))grid on%Summation of function handles yysum = @(arg) sum(cell2mat(cellfun(@(fun)fun(arg),y(:),'uni',0)),1);figure(2)plot(x,ysum(x))xlim(x([1,end]))grid on●