0 Up votes0 Down votes

3 views6 pagesMicrocontroller

Mar 13, 2015

Numerical Methods

© © All Rights Reserved

PDF, TXT or read online from Scribd

Microcontroller

© All Rights Reserved

3 views

Numerical Methods

Microcontroller

© All Rights Reserved

- Steve Jobs
- Wheel of Time
- NIV, Holy Bible, eBook
- NIV, Holy Bible, eBook, Red Letter Edition
- Cryptonomicon
- The Woman Who Smashed Codes: A True Story of Love, Spies, and the Unlikely Heroine who Outwitted America's Enemies
- Contagious: Why Things Catch On
- Crossing the Chasm: Marketing and Selling Technology Project
- Everybody Lies: Big Data, New Data, and What the Internet Can Tell Us About Who We Really Are
- Zero to One: Notes on Start-ups, or How to Build the Future
- Console Wars: Sega, Nintendo, and the Battle that Defined a Generation
- Dust: Scarpetta (Book 21)
- Hit Refresh: The Quest to Rediscover Microsoft's Soul and Imagine a Better Future for Everyone
- The Innovators: How a Group of Hackers, Geniuses, and Geeks Created the Digital Revolution
- Crushing It!: How Great Entrepreneurs Build Their Business and Influence—and How You Can, Too
- Make Time: How to Focus on What Matters Every Day
- Algorithms to Live By: The Computer Science of Human Decisions
- Wild Cards

You are on page 1of 6

Numerical Methods

One type of problem you'll see over and over again is solving for x where f(x) = 0. For example, find the

solution to

y = (x-2)(x+3)

y=5-x

You can convert this to f(x) = 0 by

Guess x

Solve for y in each equation

Take the difference

The solution is when the difference is zero:

f(x) = (x - 2)(x + 3) - (5 - x)

Graphical Solution:

Guess what the answer is and plot f(x) in this range. Note that it helps to know the answer

(approximately) to find the answer. A plot of f(x) is as follows:

-->x = [-5:0.01:5]';

-->y1 = (x-2).*(x+3);

-->y2 = 5-x;

-->f = y1-y2;

-->plot(x,f)

-->xgrid(5);

-->xlabel('x');

-->ylabel('f(x)')

January 3, 2011

NDSU

Numerical Methods

Interval Halving:

Specify to points:

One where f(x1) < 0

One where f(x2) > 0

Try the midpoint between x1 and x2.

x3 = (x1 + x2)/2

If f(x3) > 0, replace x2 with x3.

If f(x3) < 0, replace x1 with x3.

For example, let the initial guess be

x1 = -1

f(x1) < 0

x2 = +5

f(x2) > 0

-->x1 = -1;

-->f1 = (x1-2).*(x1+3) - (5-x1)

- 12.

-->x2 = +5;

-->f2 = (x2-2).*(x2+3) - (5-x2)

24.

-->x3 = (x1+x2)/2

2.

-->f3 = (x3-2).*(x3+3) - (5-x3)

- 3.

This is negative, so replace the left endpoint (x1) with x3 and repeat

-->x1 = x3;

-->x3 = (x1+x2)/2

3.5

-->f3 = (x3-2).*(x3+3) - (5-x3)

8.25

(Iteration 2): Now the midpoint is 3.5 and f() is positive. Replace the right endpoint with the midpoint:

-->x2 = x3;

-->x3 = (x1+x2)/2

2.75

-->f3 = (x3-2).*(x3+3) - (5-x3)

2.0625

(Iteration 3): Again, f() at the midpoint is positive, so replace the right endpoint

-->x2 = x3;

-->x3 = (x1+x2)/2

2.375

-->f3 = (x3-2).*(x3+3) - (5-x3)

- 0.609375

2

January 3, 2011

NDSU

Numerical Methods

(Iteration 4)

-->x1 = x3;

-->x3 = (x1+x2)/2

2.5625

-->f3 = (x3-2).*(x3+3) - (5-x3)

0.6914062

(Iteration 5)

-->x2 = x3;

-->x3 = (x1+x2)/2

2.46875

-->f3 = (x3-2).*(x3+3) - (5-x3)

0.0322266

Keep going until f() is close enough to zero. The answer is close to .246875.

California Method:

This is about the same as interval halving, but interpolate to find the next guess rather than using the

midpoint. For example, for the previous figure, you'd interpolate by assuming a linear relationship for

f(x) and find the zero crossing given the endpoints. In this case, you'd guess x = +1 (the zero crossing

assuming a linear interpolation between the endpoints.) Since f(x1) is negative, replace the right endpoint

and repeat.

x x

x 3 = x 1 f(x 22)f(x1 1 ) f(x 1 )

3

January 3, 2011

NDSU

Numerical Methods

-->x1 = -1;

-->f1 = (x1-2).*(x1+3) - (5-x1)

- 12.

-->x2 = 5;

-->f2 = (x2-2).*(x2+3) - (5-x2)

24.

-->x3 = x1 - (x2-x1)/(f2-f1)*f1

1.

-->f3 = (x3-2).*(x3+3) - (5-x3)

- 8.

(Iteration 2): This doesn't give f(x) = 0, so keep iterating. Replace the left endpoint and repeat.

-->x1 = x3;

-->f1 = (x1-2).*(x1+3) - (5-x1);

-->x3 = x1 - (x2-x1)/(f2-f1)*f1

2.

-->f3 = (x3-2).*(x3+3) - (5-x3)

- 3.

(Iteration 3): This doesn't give f(x) = 0, so keep iterating. Replace the left endpoint and repeat.

-->x1 = x3;

-->f1 = (x1-2).*(x1+3) - (5-x1)

-->x3 = x1 - (x2-x1)/(f2-f1)*f1

2.3333333

-->f3 = (x3-2).*(x3+3) - (5-x3)

- 0.8888889

(Iteration 4): This doesn't give f(x) = 0, so keep iterating. Replace the left endpoint and repeat.

-->x1 = x3;

-->f1 = (x1-2).*(x1+3) - (5-x1)

-->x3 = x1 - (x2-x1)/(f2-f1)*f1

2.4285714

-->f3 = (x3-2).*(x3+3) - (5-x3)

- 0.2448980

And so on. When you get close enough to f() = 0, you have fond the solution. It's close to 2.42857.

January 3, 2011

NDSU

Numerical Methods

Newton's Method:

With Newton's method, you just need an initial guess. Find the tangent at that point and see where it

intersects the axis. This is your next guess:

-->x1 = 4;

-->f1 = (x1-2).*(x1+3) - (5-x1)

13.

(Iteration 1): f() isn't zero, so find the tangent, find it's zero crossing, and take that as your next guess:

-->x2 = x1 + 0.001;

-->f2 = (x2-2).*(x2+3) - (5-x2)

13.010001

-->x3 = x1 - (x2-x1)/(f2-f1)*f1

2.70013

-->x1 = x3;

-->f1 = (x1-2).*(x1+3) - (5-x1)

1.6909619

(Iteration 2): f() isn't zero, so find the tangent, find it's zero crossing, and take that as your next guess:

-->x2 = x1 + 0.001;

-->f2 = (x2-2).*(x2+3) - (5-x2)

1.6983632

-->x3 = x1 - (x2-x1)/(f2-f1)*f1

2.4716605

-->x1 = x3;

-->f1 = (x1-2).*(x1+3) - (5-x1)

0.0524268

January 3, 2011

NDSU

Numerical Methods

(Iteration 3): f() isn't zero, so find the tangent, find it's zero crossing, and take that as your next guess:

-->x2 = x1 + 0.001;

-->f2 = (x2-2).*(x2+3) - (5-x2)

0.0593711

-->x3 = x1 - (x2-x1)/(f2-f1)*f1

2.4641109

-->x1 = x3;

-->f1 = (x1-2).*(x1+3) - (5-x1)

0.0000645

ans:

x = 2.641109

Note that Newton's method converges much faster and you don't need an initial guess that's above and

below zero. You do need an initial guess, however.

It helps to know what the answer is to find the answer,

Methods with the name of 'Newton' or 'Gauss' tend to be good methods to use.

January 3, 2011

- Use of Data Obtained a via Global Positioning System to Verify Numerical Flow Results in a LakeUploaded byEndless Love
- NM Practical FileUploaded byjangra014
- Ass2 Solution 14Uploaded byHassni Croni
- A Powerful Solution Algorithm for Single-stage Flash ProblemsUploaded byDebo Gao
- MATLAB Assignment Help myassignmenthelp.netUploaded byJulia Ray
- MatlabUploaded byZuber Khan
- Burden8va Análisis Numérico SolucionarioUploaded byMarlinho Pace
- Poster Ht11 13Uploaded bysug_otw
- l1magic_notesUploaded byLan Vũ
- Chunwu Wang, Huazhong Tang and Tiegang Liu- An Adaptive Ghost Fluid Finite Volume Method for Compressible Gas-Water SimulationsUploaded byMallamax
- Chapter 1 ErrorsUploaded bytaqiyuddinm
- Numerical Solution Based Parameter Estimation_2009Uploaded bypraveenpinnoji
- DiodeModels.pdfUploaded byTeferi Lemma
- LaminateUploaded byTeuku Andy
- DocumentfffUploaded byAhmad Rahman
- FINAL ANSCSE14 Proceedings w CoverUploaded byariyanamvong8041
- NFFDIP_NBFDIPUploaded byKatusiime Jovita
- B.tech SyllabusEffective From 2012 2013 Academic SessionsUploaded bypraveen972911
- 1720110Uploaded byAmit Thoriya
- On the Nature of Waves in Canals & Gate Stroking & ControlUploaded bynikif
- 10.1002@cjce.22054Uploaded byjjvolante
- Bogdan Mihaila et al- Stability and dynamical properties of Rosenau-Hyman compactons using Padé approximantsUploaded byPomac232
- Roberto GarciaUploaded byry15
- J. William Helton, Orlando Merino (Author) - Classical Control Using H-Infinity Methods - Theory, Optimization and Design (Society for Industrial Mathematics,1998,0898714192)Uploaded byHipólito Aguilar
- 9. ERROR CONTROL.pdfUploaded byabi
- 10.1.1.77.5669Uploaded byVenkatesh Naga Selva
- Math 807 Exam 7 Study Guide SP18.pdfUploaded byBenjamin Schmidt
- File 2Uploaded byLuis Mullins
- REPASO_01Uploaded byNoesito Aquino Aquino
- Simpson 38Uploaded bypriyadarshini212007

- lLab 3 report ece 331Uploaded byToànNguyễnKhánh
- Final ece351Uploaded byToànNguyễnKhánh
- Speaking Ielts Part 2 sampleUploaded byToànNguyễnKhánh
- Semiconductors HomeworkUploaded byToànNguyễnKhánh
- Presentation Lecture4Uploaded byToànNguyễnKhánh
- Presentation Lecture03 (cont)Uploaded byToànNguyễnKhánh
- 02 Scilab and VisSim.pdfUploaded byToànNguyễnKhánh
- Presentation Lecture03Uploaded byToànNguyễnKhánh
- Presentation Lecture2Uploaded byToànNguyễnKhánh
- Presentation Lecture1Uploaded byToànNguyễnKhánh

- webquestUploaded byapi-375469242
- CHEMICAL ENGINEERING LABORATORY 2 ChE290 F16 Exp 1 only.pdfUploaded byIsy Trupp
- Hebrew Talisman, TheUploaded byFrank Reitemeyer
- poramUploaded byHendrawan Darmalim
- Product Data SheetsUploaded byTree
- Byeways in Palestine, James Finn, 1849Uploaded byschreamonn5515
- Apple Kheer RecipeUploaded byRameshwarKanwar
- Optical Communication.pptUploaded byNavaRatnam
- C Scan PrimerUploaded byFara Saidin
- Sherline Machine CatalogUploaded byBien Morfe
- The PhotoArt.pdfUploaded byVivek Desai
- Chapter 4 Digital Modulation_Part 2_2_0Uploaded bykimberly
- Forest and Human HealthUploaded byDaisy
- 3D Simulation of the Vertical Axis Wind TurbinesUploaded byMostafa Rashed
- Enemy Tactics Techniques Doctrine Intelligence Studies 1951Uploaded byLouie_popwhatski
- Completely Reverse Heart Disease With This Revolutionary TreatmentUploaded bySamee's Music
- Katzung - Basic and Clinical Pharmacology 12th Edition (2012) PDFUploaded byAl Aleem
- Lecture 11Uploaded byLucas Ryan
- A Review on 3D Micro-Additive Manufacturing Technologies 2012Uploaded byberbri oussama
- HIPPSUploaded byAhmed Mohamed Khalil
- Data Sheet MPSH11Uploaded byxml xml
- abhyangaUploaded bysk11983
- Materials characteristics affecting CO2 curing of concrete blocks containing recycled aggregatesUploaded bysirtiendung
- word_199555Uploaded bymuslimboy_25
- 997 - Section 01.pdfUploaded byduongpn
- Open for Business EnglishUploaded byfansamaster
- Managing Water Locally: An essential dimension of community water developmentUploaded byOxfam
- Hybrid ModelUploaded byNaraen Karthik
- Traction, Etc......IUploaded byJolo Q. Bilaos
- Final ReportUploaded byandre_peters_19

## Much more than documents.

Discover everything Scribd has to offer, including books and audiobooks from major publishers.

Cancel anytime.