×

### Let's log you in.

or

Don't have a StudySoup account? Create one here!

×

### Create a StudySoup account

#### Be part of our community, it's free to join!

or

##### By creating an account you agree to StudySoup's terms and conditions and privacy policy

Already have a StudySoup account? Login here

## Mathematical Algorithms in Matlab I

by: Melvina Keeling

20

0

6

# Mathematical Algorithms in Matlab I MATH 151

Marketplace > Colorado State University > Mathematics (M) > MATH 151 > Mathematical Algorithms in Matlab I
Melvina Keeling
CSU
GPA 3.78

Staff

These notes were just uploaded, and will be ready to view shortly.

Purchase these notes here, or revisit this page.

Either way, we'll remind you when they're ready :)

Get a free preview of these Notes, just enter your email below.

×
Unlock Preview

### Preview these materials now for free

Why put in your email? Get access to more of this material and other relevant free materials for your school

COURSE
PROF.
Staff
TYPE
Class Notes
PAGES
6
WORDS
KARMA
25 ?

## Popular in Mathematics (M)

This 6 page Class Notes was uploaded by Melvina Keeling on Monday September 21, 2015. The Class Notes belongs to MATH 151 at Colorado State University taught by Staff in Fall. Since its upload, it has received 20 views. For similar materials see /class/210093/math-151-colorado-state-university in Mathematics (M) at Colorado State University.

×

## Reviews for Mathematical Algorithms in Matlab I

×

×

### What is Karma?

#### You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 09/21/15
COLOSTATE SPRING 2009 MATH 151 LECTURE 3 Plot Curves Secant Lines and Tangent Lines For the function fx sinx at 0 7T47 plot the secant lines through the points x07f0 and 0 h7fx0 h for h 12714718 and the tangent line to the function at 0 Z SecTanLinesm Z Courtesy of Dr Anton Betten Z Adopted by Jiangguo James Liu ColoState 012009 Clear all figure1 Z hold off X linspace0pi2101 y sinx a pi4 b sina for h 12 14 18 C a h d sinc slopesecant d bC a Xparam linspace 1111 yparam slopesecantxparam Z plota C b d ob plotx y 7 k aXparambyparam b title sinx at Xpi4 Xlabel x ylabel y axis tight Z setgcaXTick0 pi8 pi2 setgcaXTiCkLabel0pi8pi43pi2pi2 hold on end slopetangent cospi4 tangent slopetangentxparam plotaxparam btangent 7 r The Bisection Method for Finding Roots Description of the method For a given equation f 07 0 Choose given an interval 17 such that fafb lt 0 0 Let the initial guess be 1 a b2 0 Check 3 cases fx1 0 small enough7 fafz1 lt 077 fx1fb gt 0 Then respectively exit7 or set b 17 or set a 1 0 Next guess n1 a b2 now new Lab 0 Stop criteria 1 Threshold small enough7 say lt 10 9 2 Tolerance 1 and M close enough7 say lt 10 12 Use the following commandsfunctions abs7 if7 while end Use help or doc to get help on the commands functions that you want to use7 for example7 doc while ExamplesEquations 0 Equation of light diffraction z 7 tan 07 17 2 o Keplers equation m 7 2 sinx 17 717 3 0 Cubic equation 3 4x2 7 3 07 071 COLOSTATE SPRING 2009 MATH 151 LECTURE 2 Home Made 7139 Recall 1 717273 1 z Replacing x by 2 yields 17x2x47z6 1 2 lntegrating both sides leads to 1 d 1 1 1 Earctanl7arctan0O12 17 gi 7 which provides a simple formula for computing 7T 00 HomeMadePim 00 Use an alternating series to generate pi oo Jiangguo James Liu ColoState 012009 N input Type in a large positive odd integer 7 sum 0 sign 1 for k1z2zN sum sum sign1k sign sign end format long sum4 pi sum4 pi Related Exercise Use Matlab help to get yourself familiar with the functionscommands input7 for end7 format A Mathematical Dart Z MathDartm Z Courtesy of Dr Anton Betten Z Adopted by Jiangguo James Liu ColoState 012009 616 Clear all Close all rand seed 12345 Numberlnside 0 estimate zeros5001 for k1 500 X 1 2rand1001 y 1 2rand1001 Numberlnside Numberlnside sumx 2y 2lt1 estimatek Numberlnsidek1004 end plotestimate title darts Xlabel k ylabel COLOSTATE SPRING 2009 MATH 151 LECTURE 4 Newton7s Method for RootFinding Almost every nonlinear equation can be rewritten as f 07 where f is assumed to be a differentiable function We want to nd 0 a root of this equation 0 or a zero of the function 0 or an intersection of the curve with the x axis Let7s say7 an initial guess to the root is 0 The tangent line to the curve at point 07 f0 y fWo f0 0 The Main Idea Use the intersection of the tangent line with the s axis as an approximation to the intersection ofthe curve with the x axis Setting y 0 in the above tangent line equation7 we obtain f0 f oy assuming f x0 31 0 Of course7 in that case7 the tangent line is parallel to the x axis7 we wont have any intersection Keep doing so7 we establish an iterative scheme 95 9 m 7 V L 107 1 and this is the great Newton7s method Implementation of Newton7s Method Implement the Newton7s method as an independent function le that has the following format function aprxitr newtonfxnfxnderivtolmaxitrguess where aprx An approximation to the root itr The number of iterations executed fxn A generic function for the equation fxnderiv A generic function for the derivative tol A preset tolerance7 say 10 9 maxitr Maximal number of iterations allowed guess An initial guess to the root Things to Consider When Implementing the Newton7s Method 0 Use for end or while end for iterations 0 Use feval for the two generic functions fxn and fxnderiv 0 Store all successive approximations into a vector 0 Handle the exception case divided by zero Examples of using inline to de ne a function myfxn inline x 3 2X2 7X7 myfxnderiv inline 3x 2 2 7X7

×

×

×

### You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

## Why people love StudySoup

Bentley McCaw University of Florida

#### "I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"

Allison Fischer University of Alabama

#### "I signed up to be an Elite Notetaker with 2 of my sorority sisters this semester. We just posted our notes weekly and were each making over \$600 per month. I LOVE StudySoup!"

Bentley McCaw University of Florida

Forbes

#### "Their 'Elite Notetakers' are making over \$1,200/month in sales by creating high quality content that helps their classmates in a time of need."

Become an Elite Notetaker and start selling your notes online!
×

### Refund Policy

#### STUDYSOUP CANCELLATION POLICY

All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email support@studysoup.com

#### STUDYSOUP REFUND POLICY

StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here: support@studysoup.com

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to support@studysoup.com

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.