MATH 2551 Lecture Notes - Lecture 10: Cubic Hermite Spline, Linear Interpolation, Power Rule

64 views4 pages

Document Summary

Interpolation x = [2 5 8 19 20]; y = [3 8 9 10 3]; plot(x,y) Linear interpolation new_y1 = interp1(x, y, 4) new_y2 = interp1(x, y, [4,5,6]) Linear extrapolation - bad new_y2 = interp1(x, y, 25, "spline") new_y3 = interp1(x, y, 25, [], "extrap") x = linspace(0,2*pi, 1000) y = sin(x) plot(x,y,"*"); Curve fitting coeff = polyfit(x,y,999) the highest order for a unique fit is length(x) - 1 coeff is the coefficients of the polynomial length(coeff) = order + 1 new_x = linspace(0,8,1000) new_y = polyval(coeff, new_x) hold on plot(new_x,new_y,"r") Calculates the derivative by using the power rule. Uses the power rule to approximate the integral of the equation described by the coefficients: integ = [(coeff. /(length(coeff):-1:1)), 0] The following code is run in matlab: x = [2 4 6 8]; y = sin(x) vec = diff(y). /diff(x) Enter the values as they would be entered into matlab: Structure arrays by using the struct() function.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related textbook solutions

Related Documents