MATLAB Matlab multiplication of polynomials with syms

Click For Summary
The discussion addresses a problem encountered when using the 'conv' and 'conv2' functions in MATLAB with symbolic inputs, which leads to an error due to unsupported types. A suggested solution is to generate symbolic polynomials directly and multiply them instead of using convolution. The example provided illustrates how to define symbolic variables and expand the product of two polynomials using the 'expand' function in MATLAB. This approach circumvents the limitation of the convolution functions with symbolic data types.
Ngineer
Messages
62
Reaction score
1
Is there anyway around this problem?

syms m,n;
x1 = [0, 1, 4, m];
x2 = [3, n, 9, 27];
conv(x1,x2)
Undefined function 'conv2' for input arguments of type 'sym'
 
Physics news on Phys.org
The conv and conv2 functions do not accept symbolic inputs.

I recommend you just generate each symbolic polynomial and then multiply. I don't have MATLAB here but I think it would be something like this:

syms m,n;
x1 = x^2+4x-m;
x2 = 3x^3+nx^2+9x+27;
expand(x1*x2)

http://www.mathworks.com/help/symbolic/expand.html
 

Similar threads

  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
Replies
3
Views
2K
  • · Replies 14 ·
Replies
14
Views
3K
  • · Replies 4 ·
Replies
4
Views
1K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 1 ·
Replies
1
Views
5K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
4K
Replies
1
Views
2K