MATLAB: Can a function in matlab return a polynomial or an expression

matlab function

Say I want (3x-3) returned when 3 is given as an input parameter. How can I do this?

Best Answer

Hi,
if you are looking for polynomials only: polynomials of form a_n*x^n+ ...+a_1*x+a_0 are represented as vectors [a_n ... a_1 a_0], so in your case simply [3 3].
Take a look at the functions working with polynomials (at the bottom of):
doc polyfun
Titus