Using symbolic math I generate a polynomial using poly2sim in the following way :
nOrderA=input('Power of=')
A = sym('A', [1 nOrderA])
p = poly2sym(A,x)
This returns a polynomial the order of which is dependent on the user input. In the case of the user input being 3 the output of p is given by
p = (sym)
2
A₁₁⋅x + A₁₂⋅x + A₁₃
I intend to use this output as a function and do this as follows:
F = matlabFunction((p))
This value of F returned is
@(A11, A12, A13, x) A11 .* x .^ 2 + A12 .* x + A13
Here instead of the coefficients A11, A12, A13 as separate inputs to the functions, I would like to have them inputted as an array of coefficients i.e.
the value of F returned should be
@(A, x) A11 .* x .^ 2 + A12 .* x + A13
where A = [A11,A12,A13]
How should I go about doing this ?