File Exchange

image thumbnail

Multiplication of Linear Expressions

version 1.0.0.0 (666 Bytes) by Muhammad Rafiullah Arain
Multiplication of linear expressions.

0 Downloads

Updated 12 Apr 2005

No License

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.

Example

Compute the (x-2)(x+4)(x-5)...
write in following format. here x is a Row Matrix

>> x=[-2,4,5]
>> mul_l_exp(x)

Cite As

Muhammad Rafiullah Arain (2021). Multiplication of Linear Expressions (https://www.mathworks.com/matlabcentral/fileexchange/7406-multiplication-of-linear-expressions), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (3)

Ali Amir

oooh, u solve my little problem

Nadeem Malik

good work. there is a need of multiple product methods

Jos j

% 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,:)) ;
end
% p contains the coefficients
pstr = poly2str(p,'X') ;

furthermore, it can be easily changed for multiplying higher order polynomials.

MATLAB Release Compatibility
Created with R11.1
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!