Pre-Engineering 220 Introduction to MatLab ® & Scientific Programming j kiefer



Download 8.69 Mb.
Page89/128
Date02.05.2018
Size8.69 Mb.
#47255
1   ...   85   86   87   88   89   90   91   92   ...   128








check.
d. Implementation

For N data points spanning [a,b], there are N – 1 trapezoids.

If the data are uniformly spaced, then for all i, and

.

The lines in the MatLab® script might look like this:

n = 10

T = 0.0


for i=2:n

T = T + (x(i)-x(i-1))*(f(i)+f(i-1))/2.0

end



Download 8.69 Mb.

Share with your friends:
1   ...   85   86   87   88   89   90   91   92   ...   128




The database is protected by copyright ©ininet.org 2024
send message

    Main page