Environmental Engineering Reference
In-Depth Information
(Wexler 1992 ). In MATLAB
the formula is computed in an m-file 'analtrans.m' ,
which is described in the following. First input data are specified:
®
Before the formula is implemented, some auxiliary variables are introduced:
e is a row vector of length N . In another row vector t the time instants are
gathered, for which the formula is to be evaluated. There are M time instants, where
the initial time t ¼
0 is not counted. In the row vector x there are the positions, at
which the formula is evaluated. There are N locations, without start- and end-
position. In the row vector c the initial condition at t ¼
0 of the concentration at
the positions x is given.
During the execution run of the program the vector c becomes a matrix, for
which a new line is created for each of the time-instants given by vector t .This
happens in the following loop, in which the formula is implemented:
Theloop-indexis i , the current time within the loop is t(i) .The length function
determines the number of elements in a vector 1 .The h is the coefficient 1
D p 2 ,
which appears in the brackets. The lengthy expression in the third and forth line
correspond with the formula of Ogata-Banks. Note that x is a vector. In order to add or
subtract the term vt (see ( 4.4 )) it has to be ensured that the term is also a vector: this is
done by multiplication with the ones-vector e . Also note that the multiplication of the
'exp'-factor and the 'erfc'-factor in the last term of the expression has to be performed
element-wise: for that reason the multiplication-operator .* is necessary.
=
2
1 Alternatively one may use the size function. Here size(t,2) replacing length(t) works well
also. size has the advantage that it can equally be applied to matrices: size(A) delivers the number
of rows and columns of array A .
2 sqrt denotes the square root.
Search WWH ::




Custom Search