Computations in Civil and Environmental Engineering
CEE 201D

Spring 2014
Lets first go though some background information. What is a gene? Well, gene can be
interpreted as the information carried by DNA or RNA. Basically, we can see them as helix
chains of nucleotide bases
Computations in Civil and Environmental Engineering
CEE 201D

Spring 2014
CEE101D/201D
Computations in Civil and
Environmental Engineering
1
Lecture 15
More on Differentiation and Integration
(Chapter 23).
2
1
triplequad numerically evaluates
integral in 3 dimensions
Lim
Computations in Civil and Environmental Engineering
CEE 201D

Spring 2014
CEE101D/201D
Computations in Civil and
Environmental Engineering
1
Lecture 18
More on Interpolation Methods
Interpolation from data on an irregular
(nonrectangular) grid.
2
1
Application: Table Loo
Computations in Civil and Environmental Engineering
CEE 201D

Spring 2014
CEE101D/201D
Computations in Civil and
Environmental Engineering
1
Lecture 5
TOPICS and READING ASSIGNMENTS:
The switchcase structure
Save and load variables (Chapter 13).
(Useful stuff )
Function
Computations in Civil and Environmental Engineering
CEE 201D

Spring 2014
CEE101D/201D
Computations in Civil and
Environmental Engineering
1
Lecture 13
Optimization and solving nonlinear
equations (Chapter 22).
Focus on fzero and fminbnd for
onedimensional (single variab
Computations in Civil and Environmental Engineering
CEE 201D

Spring 2014
CEE101D/201D
Computations in Civil and
Environmental Engineering
1
Code for Rooms 182 and 184
113751
We have a site on Coursework
https:/coursework.stanford.edu/portal/
2
1
Lecture 2: Matlab in Action
Computations in Civil and Environmental Engineering
CEE 201D

Spring 2014
CEE101D/201D
Computations in Civil and
Environmental Engineering
1
Lecture 6
Function handles
Inline functions
More on defining and using functions
Inclass exercise
Organizing a small project
Review
Computations in Civil and Environmental Engineering
CEE 201D

Spring 2014
CEE101D/201D
Computations in Civil and
Environmental Engineering
1
Lecture 19
On solving initial value problems (IVPs),
or ordinary differential equations
(ODEs).
Matlabs numerical methods for solvi
Computations in Civil and Environmental Engineering
CEE 201D

Spring 2014
CEE101D/201D
Computations in Civil and
Environmental Engineering
1
Outline
Class Logistics
Class Objectives
2
1
Instructor:
Peter K. Kitanidis
Room 147 in Y2E2
tel.: (650) 7238321
Email: [email protected]
Computations in Civil and Environmental Engineering
CEE 201D

Spring 2014
CEE101D/201D
Computations in Civil and
Environmental Engineering
1
Lecture 4
Logical Operators
Control the flow of calculations (Chapter
11). (A critical part of programming. It
takes minutes to lea
Computations in Civil and Environmental Engineering
CEE 201D

Spring 2014
CEE101D/201D
Computations in Civil and
Environmental Engineering
1
Lecture 3
Arrays (Chapter 5). A primer.
The Basic Relational and Logical Operators
(Chapter 10).
2
1
Matrices are
rectangular arr
Computations in Civil and Environmental Engineering
CEE 201D

Spring 2014
CEE101D/201D
Computations in Civil and
Environmental Engineering
1
Lecture 9
Plotting surfaces through contour and
gridded surface functions
Plaid grids
Special grids
2
1
meshing and contouring
z l
Computations in Civil and Environmental Engineering
CEE 201D

Spring 2014
CEE101D/201D
Computations in Civil and
Environmental Engineering
1
Lecture 8
Workspace of functions, local and nested
functions
Remarks on good programs and
programming style.
3D plotting (Chapter
Computations in Civil and Environmental Engineering
CEE 201D

Spring 2014
CEE101D/201D
Computations in Civil and
Environmental Engineering
1
Lecture 10
Special grids to plot cylinders, sheres,
ellipsoids, etc.
Improving the quality of figures
Publication quality
2
1
Some
Computations in Civil and Environmental Engineering
CEE 201D

Spring 2014
clc
clear all
close all
res=10;
x=linspace(1,1,res);
y=linspace(0,2,res);
%create meshgrid
[X ,Y]=meshgrid(x,y);
%calucalte potential
pot=X.^2Y.^2;
%calculate stream function
stream=2*X.*Y;
c1=conto
Computations in Civil and Environmental Engineering
CEE 201D

Spring 2014
clc
close all
clear all
0efine constants
g = 9.81;
l=0.2485;
0efine initial conditions for 3 different cases
y01=[pi/4,0];
y02=[pi/18,0];
y03=[pi/180,0];
tspan=[0 3];
0efine odes in two equations by s
Computations in Civil and Environmental Engineering
CEE 201D

Spring 2014
clc
clear all
close all
t=50;
%call function
[a,b]=tracer(t);
%plot points in blue color
plot(a,b,'.b');
xlabel('x');
ylabel('y');
%calculate mean of locations. 2 means required to translate matrix in
Computations in Civil and Environmental Engineering
CEE 201D

Spring 2014
CEE101D/201D
Computations in Civil and
Environmental Engineering
1
Announcement
No class on Tuesday (tomorrow)
Exam will be post around 10AM on
Tue., due at 10AM on Wed.
2
1
Lecture 16
More on Diff
Computations in Civil and Environmental Engineering
CEE 201D

Spring 2014
CEE101D/201D
Computations in Civil and
Environmental Engineering
1
Lecture 17
Interpolation Methods (Chapter 18).
Onedimensional interpolation;
Twodimensional interpolation from data on
a rectang
Computations in Civil and Environmental Engineering
CEE 201D

Spring 2014
CEE101D/201D
Computations in Civil and
Environmental Engineering
1
Lecture 14
Differentiation and Integration (Chapter 23).
To compute:
Rates of change and
Lengths, areas, and volumes.
We will foc
Computations in Civil and Environmental Engineering
CEE 201D

Spring 2014
CEE101D/201D
Computations in Civil and
Environmental Engineering
1
Lecture 11
More on Array Manipulation (Chapter 5
Please go through it!)
Matrix (or Linear) Algebra (Chapter
16)
2
1
Why matrices a
Computations in Civil and Environmental Engineering
CEE 201D

Spring 2014
CEE101D/201D
Computations in Civil and
Environmental Engineering
1
Lecture 20
More on solving ODEs.
Review and continuation of solving IVPs
in MATLAB.
Example: The spring vibration problem.
Formulat
Computations in Civil and Environmental Engineering
CEE 201D

Spring 2014
CEE101D/201D
Computations in Civil and
Environmental Engineering
1
Lecture 7
Organizing a small project
About the workspace of functions
Local functions versus nested functions
Remarks on good program