Docsity

Top-Down Design & Structured Programming: Summing Maclaurin Series for exp(x) with MATLAB , Study notes of Engineering

Partial preview of the text

Download Top-Down Design & Structured Programming: Summing Maclaurin Series for exp(x) with MATLAB and more Study notes Engineering in PDF only on Docsity!

✫ ✬

✪ ✩

Top Down Design

or

Structured Programming

State the Problem

output(s)Enumerate input(s) and

✫ ✬

✪ ✩

refined)Design the Algorithm (this is

Convert to

Matlab

Test code components

Assemble and test

✫ ✬

✪ ✩

The Maclaurin series for

exp(

x )

is exp(

x ) = 1 +

(^) x (^) +

x 2

x n

n !

(^)...

Let’s designate

term

0 = 1

term

1

x , and so on

Note that

term

k

term

k − 1 k x

When

term

k < tol

stop the sum

✫ ✬

✪ ✩

The

relative terror

is

rel

sum

(^) exp(

x ) |

exp(

x )

of terms and the relative errorPrint out the sum,the number

✫ ✬

✪ ✩

tol continue, if next term exceeds

compute relative error

print information to the screen