1 Summation

The summation below uses both a while-loop and an if-statement, where size(a,1) returns the size of the first dimension of array a in other words the number of rows in array a (in this case 1). The elseif and else parts of if statements are optional.

2 Simulation of Summation

3 XPowers

When using equations to model the computation of the polynomial it was necessary to introduce an auxliliary vector
xpowers for storing the different powers of x. Alternatively, the same computation can be expressed as an algorithm including a for loop as below. This can be done without the need for an extra vector, it is enough to use a scalar variable xpower for the most recently computed power of x.

4 Simulation of Xpowers

Here the simulation of the XPowers is shown.

Value at time=0: