Numerical Integration and Solving Systems of Linear Equations: Lecture 23 - Prof. Gregory , Study notes of Biology

The lecture notes for a university course on numerical integration and solving systems of linear equations. Five methods for numerical integration using matlab, including the sum, cumulative sum, trapezoidal rule, quadrature, and polynomial integration. The lecture also introduces three types of problems involving sets of linear equations and how to solve them using matlab. The next lecture will cover interpolation, regression, and curve fitting.

Typology: Study notes

2010/2011

Uploaded on 04/11/2011

goalie4eva
goalie4eva 🇺🇸

31 documents

1 / 5

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Lecture 23: Monday April 11, 2011:
Announcements:
Note- NO lab next Thursday, April 21st. Spring Recess.
REMAINING ASSIGNMENTS:
1. Case 4 (Cortical Probe Optimization) is due Wednesday April 20th in class.
2. The last SH8 is now up and is due Wednesday April 27th in class.
3. Case 5 (Robot Arm Trajectory) will be posted soon. Due Wednesday April 27th
in class.
4. Lab Exp 2 (iEMG Controller Gain vs. Artificial Muscle Force from April 7th data
session) write-up is due Thursday April 28th in lab.
Please continue to take advantage of Prof. Sawicki’s Office Hours on M’s and T’s
from 4-5PM in 4212C EB3 or by appt. Ben’s hours are still being held Thursday
afternoons.
EVALS- Preliminary Evaluation 3 due this Wed April, 13th (2 extra points on Exam
2).
REMINDER: Complete official course evaluations on-line (neon signs around
EB3). Be fair ;)
Reading for Next Time:
-Re-Read the Debugging Cheat Sheet
-finish Ch. 8 on Solving Linear Algebraic Equations.
-start Ch. 6 on Simple Regression and CurveFitting
-Coming Up: Ch. 7. Simple Statistics, Histograms and Interpolation
*SH EC: Write a function that returns the value of the definite integral of the sine function
over a range from a lower to upper limit that is specified by the user: Do this using two
different methods for integration (e.g. trapz versus quad).
*Today’s Goals:
1.Refresh methods for Numerical Integration
2.Get into Methods for Solving Systems of Linear Equations.
*I REMEMBER: turn on your diary to save your Command Window
>>diary LectureApr11.m
1. Numerical Integration: (Palm Ch 9. pg. 370-377)
*FIVE METHODS of NUMERICAL INTEGRATION -->
1. SUM Sum of elements.
S = SUM(X) is the sum of the elements of the vector X. If
X is a matrix, S is a row vector with the sum over each
column. For N-D arrays, SUM(X) operates along the first
non-singleton dimension.
pf3
pf4
pf5

Partial preview of the text

Download Numerical Integration and Solving Systems of Linear Equations: Lecture 23 - Prof. Gregory and more Study notes Biology in PDF only on Docsity!

Lecture 23: Monday April 11, 2011: Announcements:  Note- NO lab next Thursday, April 21st. Spring Recess.  REMAINING ASSIGNMENTS:

  1. Case 4 (Cortical Probe Optimization) is due Wednesday April 20th^ in class.
  2. The last SH8 is now up and is due Wednesday April 27th^ in class.
  3. Case 5 (Robot Arm Trajectory) will be posted soon. Due Wednesday April 27th in class.
  4. Lab Exp 2 (iEMG Controller Gain vs. Artificial Muscle Force from April 7th^ data session) write-up is due Thursday April 28th^ in lab.  Please continue to take advantage of Prof. Sawicki’s Office Hours on M’s and T’s from 4-5PM in 4212C EB3 or by appt. Ben’s hours are still being held Thursday afternoons.  EVALS- Preliminary Evaluation 3 due this Wed April, 13th^ (2 extra points on Exam 2).  REMINDER: Complete official course evaluations on-line (neon signs around EB3). Be fair ;) Reading for Next Time: -Re-Read the Debugging Cheat Sheet -finish Ch. 8 on Solving Linear Algebraic Equations. -start Ch. 6 on Simple Regression and CurveFitting -Coming Up: Ch. 7. Simple Statistics, Histograms and Interpolation *SH EC: Write a function that returns the value of the definite integral of the sine function over a range from a lower to upper limit that is specified by the user: Do this using two different methods for integration (e.g. trapz versus quad). *Today’s Goals: 1.Refresh methods for Numerical Integration 2.Get into Methods for Solving Systems of Linear Equations. *I REMEMBER: turn on your diary to save your Command Window

diary LectureApr11.m 1. Numerical Integration: (Palm Ch 9. pg. 370-377) FIVE METHODS of NUMERICAL INTEGRATION --> 1. SUM* Sum of elements. S = SUM(X) is the sum of the elements of the vector X. If X is a matrix, S is a row vector with the sum over each column. For N-D arrays, SUM(X) operates along the first non-singleton dimension.

If X is floating point, that is double or single, S is accumulated natively, that is in the same class as X, and S has the same class as X. If X is not floating point, S is accumulated in double and S has class double. S = SUM(X,DIM) sums along the dimension DIM.sum Example : If X = [0 1 2 3 4 5] then sum(X,1) is [3 5 7] and sum(X,2) is [ 3 12]; *For this method, MATLAB will assume unit spacing (i.e. that dx = 1). Therefore, you must multiply S, the SUM over the array for f(x), by the appropriate dx to get the correct y=integral f(x) dx. See example code Mar30.m for an example.

  1. CUMSUM Cumulative sum of elements. CUMSUM Cumulative sum of elements. For vectors, CUMSUM(X) is a vector containing the cumulative sum of the elements of X. For matrices, CUMSUM(X) is a matrix the same size as X containing the cumulative sums over each column. For N-D arrays, CUMSUM(X) operates along the first non-singleton dimension. CUMSUM(X,DIM) works along the dimension DIM. Example : If X = [0 1 2 3 4 5] then cumsum(X,1) is [0 1 2 and cumsum(X,2) is [0 1 3 3 5 7] 3 7 12] *For this method, MATLAB will assume unit spacing (i.e. that dx = 1). Therefore, you must multiply the last element (end) of the CUMSUM output, f(x), by the appropriate dx to get the correct y=integral f(x) dx. See example code Mar30.m for an example.
  2. TRAPZ Integral over elements using the trapezoidal rule of integration. TRAPZ Trapezoidal numerical integration. Z = TRAPZ(Y) computes an approximation of the integral of Y via the trapezoidal method (with unit spacing). To compute the integral for spacing different from one, multiply Z by the spacing increment. For vectors, TRAPZ(Y) is the integral of Y. For matrices, TRAPZ(Y) is a row vector with the integral over each column. For N-D arrays, TRAPZ(Y) works across the first non-singleton dimension. Z = TRAPZ(X,Y) computes the integral of Y with respect to X using the trapezoidal method. X and Y must be vectors of the same length, or X must be a column vector and Y an array whose first non-singleton dimension is length(X). TRAPZ operates along this dimension.

5. POLYINT

POLYINT Integrate a polynomial analytically. POLYINT(P,K) returns a polynomial representing the integral of polynomial P, using a scalar constant of integration K. POLYINT(P) assumes a constant of integration K=0. *See example code Mar30.m for an example. IN CLASS PROBLEMS ON NUMERICAL INTEGRATION (w GROUP HELP)

  1. See accelerometer example 9.1.-1 Palm p. 372-
  2. Palm Ch 9.1 - T9.1-1 on p. 373.
  3. Palm Section 9.1 - #6 on p. 410. 2. Solving Systems of Linear Equations: (Palm Ch 8. pgs. 331-356) There are three types of problems involving sets of linear equations. MATLAB can handle all three types- 1. UNIQUELY DETERMINED (# Unique Equations = # Unknowns) x =inv(A)b --> solves Ax = b using Matrix Inversion x=A \ b also works. Left Division 2. UNDERDETERMINED (# Unique Equations < than # Unknowns) x = A \ b --> solves Ax = b using Left Division but makes at one unknown = 0 or x =pinv(A)b --> solves Ax = b using Pseudo-Matrix Inversion rref([A b]) will return linear combinations of unknowns forming a general soln. 3. OVERDETERMINED (# Unique Equations > # Unknowns) x = A \ b --> solves Ax = b using Left Division But in the ‘least-squares’ sense i.e. will find values that satisfy all of the equations as closely as possible). NOTE: See the decision flow chart in Fig. 8.5-1 Palm pg. 355 for a rubric on what method to use and when - by evaluating the rank of the problem. IN CLASS PROBLEMS ON LINEAR EQUATIONS (w GROUP HELP)
  4. Palm Ch 8.1 - #1 on p. 357. Matrix Inversion
  5. Palm Ch 8.2 - #4 on p. 358. Circuit Example (Left Division)
  6. Palm Ch 8.3 - #11 on p. 365. Underdetermined Example
  7. Palm Ch 8.4 - #14 on p. 366. Overdetermined Example *NEXT TIME:

More on Linear Equations then begin Interpolation, Regression, CurveFitting