170 likes | 298 Views
Introduction to write programs in MATLAB. Ecological Modeling Course Sep 25, 2006. Review for the last class. Introduction to the Programming environment (a) MATLAB windows (b) Data types (c) Input and Output data. Technical route. Input. Output. Central Model. Scalar Vector Matrix.
E N D
Introduction to write programs in MATLAB Ecological Modeling Course Sep 25, 2006
Review for the last class • Introduction to the Programming environment (a) MATLAB windows (b) Data types (c) Input and Output data
Technical route Input Output Central Model • Scalar • Vector • Matrix • Scalar • Vector • Matrix • Equations • Algorithm Forward analysis
Data input • Assignment statement: e.g. A=6; B=[1; 2; 3; 4; 5; 6; 7; 8; 9]; C=[1 2 3; 4 5 6; 7 8 9];
Data output: • Plot statement: e.g. plot(x,y);title(‘example’);xlabel(‘x axis’);ylabel(‘y axis’);
Central programs: Conceptual model Mathematical equations Computer language
(a) Simple calculation • Add • Subtract • Multiply • Divide
Example I: • Simple equations
Example II: • Discontinuous function
Example III: Photosynthesis rate
Example IV: • Fibonacci number 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, …… Number 1000 =
Example V: • Differential equation
Homework: Based on Equation (3.1) and (3.2) (Page 5) & initial values in Figure 2 legend (Page 8) • Develop two-species model to simulate species abundance dynamics and Generate figure 2