University of California, Berkeley Fall Semester 2008
Department of Mechanical Engineering Instructors: M. Frenklach, R. Horowitz
E7, Assignment 6
Assigned: Friday, October 10, 2008 Due: 12:00 pm, Friday, October 17, 2008. This assignment is an introducti
Page 2 Part A (10 points)
Name:
A.1 (3 points) Complete the following MATLAB function, called currency conv. function Aout=currency_conv(Ain,Tin,Tout) % The function converts money from one currency to % another. % Ain : input amount % Tin : input currenc
University of California, Berkeley Fall Semester 2008
Department of Mechanical Engineering Instructors: M. Frenklach, R. Horowitz
E7, Assignment 3
Assigned: Thursday, September 18, 2008 Due: 12:00pm, Friday, September 26, 2008. This assignment is an intro
Problem 13.50 Solution This is a physical pendulum. Since it takes 120s to complete 100 swings. Period is T = 120s/100 = 1.2s Use the formula (14-14), replace h by d, the distance from center of gravity to pivot point, T = 2 I mgd
We can solve for moment
Problem 10.40 Since the net external torque is zero, the angular momentum is conserved L0 = L f . That is, I 00 = I f f . Since f is given (0.40 rev/s), we only need to calculate I 0 and I f , by considering that the total moment of inertia I is the sum o
Two worlds on a string
Instead of giving the whole solution, here I'll just add some explanation to this problem since the hints of this problem already set up all the steps needed. As the picture indicated, we can separate the motion of the two balls to
University of California, Berkeley Fall Semester 2005
College of Engineering Professor R. Dibble and R. Horowitz
E77 Midterm Examination I
Monday September 26, 2005 Name : SID :
Section:
1
2
(Please circle your lecture section)
Please circle your Laborato
LECTURE 29
Procedural Programming
The design focuses on steps that must be executed executed to achieve a desired state. One typically represents data as individual variables or fields of a structure and implement operations as functions that take the va
LECTURE 25
Numerical Integration
Textbook: Sections 8.1 & 8.2
E7, Fall 2008, M. Frenklach
1
NUMERICAL INTEGRATION
f(x)
b
a
f ( x ) dx
b x
0
a
2
NUMERICAL INTEGRATION
f(x)
b
Trapezoidal Rule a
0 a b x
f ( x ) dx
3
1
TRAPEZOIDAL RULE
f(x)
y ( x i ) + y (
University of California, Berkeley Fall Semester 2008
Department of Mechanical Engineering Instructors: M. Frenklach, R. Horowitz
E7, Assignment 1
Assigned: Friday, September 5, 2008 Due: 12:00pm, Friday, September 12, 2008. This assignment is an introduc
University of California, Berkeley Fall Semester 2008
Department of Mechanical Engineering Instructors: M. Frenklach, R. Horowitz
E7, Assignment 2
Assigned: Thursday, September 11 2008 Due: 12:00pm, Friday, September 19, 2008. This assignment is an introd
ERROR TOLERANCE
computed "exact" some answer answer tolerance
ERRORS Absoluteerror = approximate value true value Relativeerror = absolute error/true value
TRUNCATION ERRORS
x x e = 1+ x + + +L 2! 3! S1 = 1 + x 2 x S2 = 1 + x + 2!
x
2
3
TRUNCATION ERROR
University of California, Berkeley Fall Semester 2008
Department of Mechanical Engineering Instructors: M. Frenklach, R. Horowitz
E7, Assignment 12
Assigned: Tuesday, December 3, 2008 Due: 12:00 pm (noon), Wednesday, December 10, 2008 This assignment is o
University of California, Berkeley Fall Semester 2008
Department of Mechanical Engineering Instructors: M. Frenklach, R. Horowitz
University of California, Berkeley Fall Semester 2008
Department of Mechanical Engineering Instructors: M. Frenklach, R. Horo
University of California, Berkeley Fall Semester 2008
Department of Mechanical Engineering Instructors: M. Frenklach, R. Horowitz
E7, Assignment 11
Assigned: Saturday, November 22, 2008 Due: 12:00 pm (noon), Wednesday, December 3, 2008 This assignment is
University of California, Berkeley Fall Semester 2008
Department of Mechanical Engineering Instructors: M. Frenklach, R. Horowitz
E7, Assignment 10
Assigned: Thursday, November 6, 2008 Due: 12:00 pm (noon), Wednesday, November 19, 2008 This assignment is
University of California, Berkeley Fall Semester 2008
Department of Mechanical Engineering Instructors: M. Frenklach, R. Horowitz
E7, Assignment 9
Assigned: Thursday, October 30, 2008 Due: 12:00 pm, Friday, November 7, 2008. This assignment is an introduc
University of California, Berkeley Fall Semester 2008
Department of Mechanical Engineering Instructors: M. Frenklach, R. Horowitz
E7, Assignment 8
Assigned: Thursday, October 23, 2008 Due: 12:00 pm, Friday, October 31, 2008. This assignment is an introduc
University of California, Berkeley Fall Semester 2008
Department of Mechanical Engineering Instructors: M. Frenklach, R. Horowitz
E7, Assignment 7
Assigned: Thursday, October 16, 2008 Due: 12:00 pm, Friday, October 24, 2008. This assignment is a continuat
University of California, Berkeley Fall Semester 2008
Department of Mechanical Engineering Instructors: M. Frenklach, R. Horowitz
E7, Assignment 5
Assigned: Thursday, October 2, 2008 Due: 12:00 pm, Wednesday, October 8, 2008. This assignment is an introdu
University of California, Berkeley Fall Semester 2008
Department of Mechanical Engineering Instructors: M. Frenklach, R. Horowitz
E7, Assignment 4
Assigned: Thursday, September 25, 2008 Due: 12:00pm, Friday, October 3, 2008. This assignment is an introduc
LECTURE 24
DERIVATIVE = SLOPE
f(x)
Numerical Differentiation Finite Differences
Textbook: Section 8.3
E7, Fall 2008, M. Frenklach
0
a
x
f ( x = a ) = lim
0
f (a + ) f (a)
2
NUMERICAL DIFFERENTIATION
f(x)
FINITE DIFFERENCES
x y 0 0 1 1 2 8 3 27 4 64 5 125
LECTURE 20
Recursion
Recursion vs Iteration
E7, Fall 2008, M. Frenklach
1
RECURSION: xn = xn-1 * x function y = powerfun(x,n) % recursion: x^n = x^(n-1)*x if n = 1 y = x; else y = powerfun(x,n-1) * x; end
2
RECURSION: Fibonacci numbers
1 1 2 3 5 8 13 21 3
Other types of functions E7: INTRODUCTION TO COMPUTER E7: INTRODUCTION TO COMPUTER PROGRAMMING FOR SCIENTISTS AND ENGINEERS
Lecture Outline 1. 2. 3. Anonymous functions Sub functions functions Nested Functions Th There are four other types of functions
A