Lab_2_2015

# Lab_2_2015 - Addition Scalar multiplication Transposition...

This preview shows pages 1–23. Sign up to view the full content.

Lab 2: Mathematical Modeling, Numerical Methods, and Problem Solving (chapter 1) Roundoff and Truncation Errors (chapter 4) BME 113L Introduction to Numerical Methods in Biomedical Engineering 2015 Spring 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Lab1 Review Lets wet our feet.. - x is an array of numbers from 0 to 1 with a step size of 0.1 - y = x3 – xsinx - Calculate the values of y. (Think Dot Product!) 2
Lab1 Review Ok….Time to Plot - x is an array of numbers from 0 to 1 with a step size of 0.1 - y = x3 – xsin(x) - z = tan(x) - Plot y and z in the same plot (Use subplots) 3

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Passing Functions to m-files Anonymous Functions >> [email protected](x,y) x^2 + y^2; >> f1(3,4) ans = 25 4
Passing Functions to m-files Function Functions >> [email protected](t) ... sqrt(9.81*68.1/0.25)*tanh(sqrt(9.81*0.25/68.1)*t); >> fplot(vel,[0 12]) 5

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Another example function favg = funcavg (f,a,b,n) >> [email protected](t) ... sqrt(9.81*68.1/0.25)*tanh(sqrt(9.81*0.25/68.1)*t) ; >> funcavg(vel,0,12,60) What is the use of that? Think again… >> funcavg(@sin,0,2*pi,180) 6
Movie Function movie( m,n,fps ) eg. Refer Pg 69 & 70 (Example 3.6) 7

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
8
Linear Algebra Solving a system of equations Written in Matrix form: 9

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Matrix calculations (from Lab 1) 10 Addition

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Addition Scalar multiplication Transposition Matrix multiplication Matrix Multiplication • Defined when inner dimensions are same 11 • Determinant • Inverse of a Matrix 12 13 Approach • Analyze, understand, have general idea of how you would solve the problem (approach) • Perform derivations necessary for numerical solution of the problem • Write MATLAB program(s) (script, functions, etc.) to solve problem numerically • Test your program using analytical 14 15 16 Chapter-4 17 MATLAB CODE 18 Chapter-4 19 4.5 In a fashion similar to Prob. 4.4, develop your own M-file to determine the smallest positive real number used in MATLAB. Base your algorithm on the notion that your com- puter will be unable to reliably distinguish between zero and a quantity that is smaller than this number. Note that the result you obtain will differ from the value computed with realmin. Challenge question: Investigate the results by taking the base-2 logarithm of the number generated by your code and those obtained with realmin. MATLAB CODE 20 LAB ASSIGNMENT 21 22 23...
View Full Document

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern