Example: Polynomial Interpolation
Page 1 of 4
eLearning
Knowledge Base Your System Administrator has Installed: Search LearningConnector
2 recommended topics from 2 courses
PTC LearningConnector
Get Started
Setup
Mathcad Prime 2.0 - Application Orientation
Copy Expressions
Start using Mathcad Prime 2.0 with these free tutorials!
Example: Polynomial Interpolation
polyint U se t he polyint f unct i on t o perf orm pol ynom i ali nt erpol at i on on a dat a set . i ne a dat a set . 1. D ef
2. Cal lt he polyint f unct i on t o cal cul at et he pol ynom i ali nt erpol at i on of t he dat a set at a part i cul ar poi nt .
At x = 328, t he i nt erpol at ed resul ti s y = -0.189, w i t h an error of 0. 056. 3. D ef i ne t he range of x val ues w here you w ant t of i nd t he i nt erpol at ed y val ues.
4. Record t he i nt erpol at ed val ues and t hei r respect i ve error.
5. Pl ot t he dat a poi nt s, t he i nt erpol at ed curve, and t he error est i m at e.
http://127.0.0.1:63996/mprime_en/mprime/example_polynomial_interpolation.html?queryI...
3/5/2013
Example: Polynomial Interpolation
Page 2 of 4
Copy Expressions
polycoeff To cal cul at et he i nt erpol at ed val ues, use polyint. To cal cul at e bot ht he i nt erpol at i ng pol ynom i al and som e of i t s deri vat i ves, use polycoeff. The coef f i ci ent s provi ded by polycoeff are l ess accurat e at gi ven dat a poi nt s, so t hey are not t he best represent at i on of i nt erpol at ed val ues. 1. Fi nd t he pol ynom i alcoef f i ci ent sf or t he pol ynom i alcurve t hat passes t hrough t he set of dat a poi nt s def i ned above.
2. D ef i ne a pol ynom i alf unct i on, w here c i st he vect or of pol ynom i alcoef f i ci ent s.
3. D i f f erent i at et he pol ynom i alf unct i on.
http://127.0.0.1:63996/mprime_en/mprime/example_polynomial_interpolation.html?queryI...
3/5/2013
Example: Polynomial Interpolation
Page 3 of 4
4. Pl ot t he dat a poi nt s, t he pol ynom i ali nt erpol at i on, and i t sf i rst deri vat i ve.
Copy Expressions
The polycoeff f unct i on does not const ruct t he pol ynom i alof best l east -squares f i t , as i s done by t he polyfit f unct i on. The resul t s of polyint and polycoeff shoul d not be used t o m ake predi ct i ons f or y val ues out si de of t he range of t he ori gi nalx val ues. polyiter U se t he polyiter f unct i on t o perf orm a pol ynom i ali nt erpol at i on. 1. D ef i ne t he m axi m um possi bl e num ber of i t erat i ons and t he t ol erance.
2. Cal lt he polyiter f unct i on.
The al gori t hm di d not converge, so i t di d not st op bef ore t he N_max i t erat i on. It di d not achi eve an error of 0. 01 and i t ret urned t he sam e resul t as polyint:
3. Pl ot t he ori gi nalpoi nt s, t he exact pol ynom i al , and t he i t erat ed pol ynom i al .
http://127.0.0.1:63996/mprime_en/mprime/example_polynomial_interpolation.html?queryI...
3/5/2013
Example: Polynomial Interpolation
Page 4 of 4
Copy Expressions
Related Links
Li near Predi ct i on
http://127.0.0.1:63996/mprime_en/mprime/example_polynomial_interpolation.html?queryI...
3/5/2013