|
Contents | Previous | Next | Subchapters |
| Syntax |
trapz(y) |
trapz(x, y) | |
trapz(y, d) | |
trapz(x, y, d) | |
| See Also | gaussq , quadint |
/ x(N) N-1
| ---
| F(x) dx ~= > [ x - x ] [ F(x ) + F(x ) ] / 2
| --- i+1 i i i+1
/ x(1) i=1
where N is the length of the vector x.
The arguments x, y and d
are integer, real, double-precision, or complex.
The return value has the type that results from coercion
between the type of x and the type of y.
If the argument x is not present,
the default value
x = i
i
is used.
The relationship between F(x), N,
and the arguments y, d,
is defined below.
trapz(y)
If y is a row vector,
N is the column dimension of y and
y = F(i)
i
If y is not a row vector,
N is the row dimension of y and
[y , ... , y ] = F(i)
i,1 i,n
where n is the column dimension of y.
trapz(x, y)
If y is a row vector,
N is the column dimension of y and
y = F(x )
i i
If y is not a row vector,
N is the row dimension of y and
[y , ... , y ] = F(x )
i,1 i,n i
where n is the column dimension of y.
trapz(y, d)
trapz(x, y, d)
The argument d must be equal to one or two.
If d is equal to one,
N is the row dimension of y and
[y , ... , y ] = F(x )
i,1 i,n i
where n is the column dimension of y.
If d is equal to two,
N is the column dimension of y and
T
[y , ... , y ] = F(x )
i,1 i,n i
where n is the row dimension of y.
F(x) = x.
In addition,
1
1 /
- = | x dx
2 /
0
If you enter
clear
x = linspace(0d0, 1d0, 5)
y = x
trapz(x, y)
O-Matrix will reply
0.5
trapz(y, d)