In the following code I assemble a sequence of polynomials (the Chebyshev polynomials, to be exact) symbolically, and then use matlabFunction() to convert each symbolic expression into a function handle. Each function handle is then placed in the cell array.
N = 10;C = cell(N,1);syms y;T = sym(zeros(N,1));T(1) = 1;T(2) = y;C{1} = matlabFunction(T(1));C{2} = matlabFunction(T(2));for n = 2:1:N-1 T(n+1) = 2*y*T(n) - T(n-1); C{n+1} = matlabFunction(T(n+1));endevalArray = @(y)cellfun(@(f)f(y),C);evalArray(3)
However, evalArray(3), which is intended to evaluate each polynomial at y=3, gives the error: "Error using symengine>@()1.0;Too many input arguments."
Any suggestions? Thanks all for your help.
Best Answer