Script for the multiplication of linear expressions without coefficient constants. This script returns a polynomial of given expressions.
The number of expressions are not restricted and constant may be real or integer.
Compute the (x-2)(x+4)(x-5)...
write in following format. here x is a Row Matrix
Muhammad Rafiullah Arain (2021). Multiplication of Linear Expressions (https://www.mathworks.com/matlabcentral/fileexchange/7406-multiplication-of-linear-expressions), MATLAB Central File Exchange. Retrieved .
oooh, u solve my little problem
good work. there is a need of multiple product methods
% This will do something very similar, but more efficient:
x = [-2, 4 5] ;
x = [ones(length(x),1) x(:)] ;
i = 1 ;
p = x(i,:) ;
while (i < size(x,1)),
i = i + 1 ;
p = conv(p,x(i,:)) ;
% p contains the coefficients
pstr = poly2str(p,'X') ;
furthermore, it can be easily changed for multiplying higher order polynomials.
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!