MATLAB: Literal Variables

Control System ToolboxMATLABpolynomialvariables

Hy, I'm an italian Computer Engineering student from Italy and I just started using MATLAB for the work of my bachelor thesis. I'm trying to write some polynomials with literal variables different from x, like these:
A= x^3-b*x^2+a;
B= x^2+a*x-b
I would like then to apply the operations of sum, difference and product between these polynomials. I tried using:
>> syms a;
>>S=[1 -1 2];
>> G=[1 a 2];
>> P= conv(S, G)
but what I obtain is this error message:
Undefined function 'conv2' for input arguments of type 'sym'.
Error in conv (line 39)
c = conv2(a(:),b(:),shape);
HELLLLP!!!! PLEASEEE!!!! THX 😉

Best Answer

conv isn't defined for symbolic inputs. Fortunately, sum/prod/diff are!
doc sym>sum
doc sym>prod
doc sym>diff