polypower


Untitled

Raises a polynomial to a non-negative integer power

Syntax

q = polypower(p,k)

Description

q = polypower(p,k) returns the polynomial q (in MATLAB® polynomial form) that results from raising polynomial p to a non-negative integer power of k.

Examples

Example 1 The efficiency of the polypower function
Raising a polynomial to a power can also be accomplished using the MATLAB® Symbolic Math Toolbox, but at a much slower rate than that offered by the polypower function. Consider, for example, the polynomial
raised to the power of 3. This can be accomplished using symbolics:
tic
sym2poly(expand((sym(‘x’)^2+sym(‘x’)+1)^3))
ans = 1×7
1 3 6 7 6 3 1
toc
Elapsed time is 1.852324 seconds.
or the polypower function:
tic
polypower([1 1 1],3)
ans = 1×7
1 3 6 7 6 3 1
toc
Elapsed time is 0.030895 seconds.
which accomplishes the task at a much faster rate.

This function is part of……..

PolyTools_Logo_v1.1.png