Environmental Engineering Reference
In-Depth Information
needed. It may be useful in any M-file in which data from scanned graphs are
processed. It is no problem, if the variables in both files have different names:
georef can be called from both, each using its own names for the variables, as
explained. That's the advantage of using functions in comparison to using scripts.
The majority of M-files accompanying this topic are written as functions, i.e. the
first command is the function command without input and output parameters. In
most modules the first line is not necessary: the reader of this topic will already have
recognized that the function line is omitted in the printed listings. The major
reason for using the first command in the files is to ensure the user that the right
program is called. Because function-name and file-name are identical, the module
can be recognized by the file name.
The function commands, printed in the topic, are always necessary. Sometimes
the reason is that input and/or output parameters have to be specified. It is also
necessary to use the function command if there are subfunctions within the M-file.
Otherwise MATLAB
gives an error message, as can be demonstrated by the
®
following lines:
A = 1;
function demo (A)
A = 2;
Error: A function declaration cannot appear within a script M-file.
Subfunctions are functions that are called within an M-file. There have been several
examples already. Within the ' pdepetrans.m ' file (see Chapter 4), there are calls to
three subfunctions:
function [c,f,s] = transfun(x,t,u,DuDx,D,v,lambda,…)
function u0 = ictransfun(x,D,v,lambda,sorption,k1,k2,c0,cin)
function [pl,ql,pr,qr] = bctransfun(xl,ul,…)
The calling rules, explained in this chapter, have already been applied there.
References
Gonzales RG, Woods RE, Eddins SL (2004) Digital image processing using MATLAB. Prentice
Hall, Upper Saddle River, p 624
Marsili-Libelli S, Caporali E, Arrighi S, Becattelli C (2001) A georeferenced quality model. Water
Sci Tech 43(7):223-230
Marsili-Libelli S, Pacini G, Barresi C, Petti E, Sinacori F (2002) An interactive georeferenced
water quality model. In: Falconer RA, Lin B, Harris EL, Wilson CAME, Cluckie ID, Han D,
Davis JP, Heslop S (eds) Proc. Hydroinformatics 2002. Cardiff
Raterman B, Schaars FW, Griffioen M (2001) GIS and MATLAB integrated for groundwater
modeling (2001) ESRI User Conference, Proc, San Diego
Trauth MH (2010) MATLAB recipes for earth sciences, 3rd edn. Springer, Berlin, Heidelberg,
p 336
Search WWH ::




Custom Search