Lab_2_2015 - Addition Scalar multiplication Transposition...

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

View Full Document Right Arrow Icon
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
Image of page 1

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

View Full Document Right Arrow Icon
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
Image of page 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
Image of page 3

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

View Full Document Right Arrow Icon
Passing Functions to m-files Anonymous Functions >> [email protected](x,y) x^2 + y^2; >> f1(3,4) ans = 25 4
Image of page 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
Image of page 5

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

View Full Document Right Arrow Icon
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
Image of page 6
Movie Function movie( m,n,fps ) eg. Refer Pg 69 & 70 (Example 3.6) 7
Image of page 7

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

View Full Document Right Arrow Icon
8
Image of page 8
Linear Algebra Solving a system of equations Written in Matrix form: 9
Image of page 9

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

View Full Document Right Arrow Icon
Matrix calculations (from Lab 1) 10 Addition
Image of page 10
Image of page 11

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

View Full Document Right Arrow Icon
Image of page 12
Image of page 13

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

View Full Document Right Arrow Icon
Image of page 14
Image of page 15

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

View Full Document Right Arrow Icon
Image of page 16
Image of page 17

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

View Full Document Right Arrow Icon
Image of page 18
Image of page 19

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

View Full Document Right Arrow Icon
Image of page 20
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

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern