[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Returning polynomial coefficients from matlabFunction as an array

**From**: |
iceman |

**Subject**: |
Returning polynomial coefficients from matlabFunction as an array |

**Date**: |
Thu, 25 Aug 2016 04:50:38 -0700 (PDT) |

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 ?
--
View this message in context:
http://octave.1599824.n4.nabble.com/Returning-polynomial-coefficients-from-matlabFunction-as-an-array-tp4679463.html
Sent from the Octave - General mailing list archive at Nabble.com.

**Returning polynomial coefficients from matlabFunction as an array**,
*iceman* **<=**