Homework #6 Brief Solutions 2011

Size: px
Start display at page:

Download "Homework #6 Brief Solutions 2011"

Transcription

1 Homework #6 Brief Solutions %page 95 problem 4 data=[-,;-,;,;4,] data = xk=data(:,);yk=data(:,);s=csfit(xk,yk,-,) %Using the program to find the coefficients S = S=.456*(x+).^ -.456*(x+).^-*(x+)+; S= -.5*(x+).^+.9*(x+).^ *(x+); S=.*(x-).^ -.58*(x-).^+.87*(x-)+; x=-:.:4; y=spline_eval(s(:,4),s(:,),s(:,),s(:,),xk,x); plot(xk,yk, o,x,y) % see plot below %p95 problem 5 type natspline_coeff function [a,b,c,d]=natspline_coeff(knots,data); %% function [a,b,c,d]=natspline_coeff(knots,data); %% Modification of Cheney Kincaid pseudo-code %% The natural spline for interpolating data at the knots a=x<...<x_n=b; %% System of equations is solved using the tridiagonal nature %% WARNING: THIS PROGRAM REQUIRES AT LEAST 4 KNOTS %% INPUT: %% knots - distinct points (t_j) of interpolation as a row vector %% data - data at the interpolation points as a row vector %% OUTPUT: %% a - column vector of constant terms for the spline on [t_j,t_(j+)] %% b - column vector of coefficients of x-t_j for the spline on [t_j,t_(j+)] %% c - column vector of coefficients of (x-t_j)^ for the spline on [t_j,t_(j+)] %% d - column vector of coefficients of (x-t_j)^ for the spline on [t_j,t_(j+)] % determine lengths of the intervals n=length(knots)-; for j=:n; h(j)=knots(j+)-knots(j); % determine the right hand side of the system (without first and last eqn) for i=:n; rhs(i)=6*((data(i+)-data(i))/h(i)-(data(i)-data(i-))/h(i-)); % solve the system using tri_diag.m z()=; z(n+)=;

2 dd=*(h(:n)+h(:n-)));subd=h(:n-);supd=h(:n-); z(:n)=tri_diag(dd,subd,supd,rhs(:n)); % find the other coefficients for j=:n;file://localhost/users/sherm/math4/natspline_coeff b(j,)=(data(j+)-data(j))/h(j) - h(j)*(z(j+)+*z(j))/6; d(j,)=(z(j+)-z(j))/(6*h(j)); a=data(:n) ; c=z(:n) /; %applying this [a,b,c,d]=natspline_coeff(xk,yk ) a = b = c = d = S=.47*(x+).^ -.47*(x+).^-.47*(x+)+; S= -.47*(x+).^+.48*(x+).^ -.575*(x+); S=.856*(x-).^-.77*(x-).^+.876*(x-)+; naty=spline_eval(a,b,c,d,xk,x); plot(xk,yk, o,x,naty) %p95 problem 6 %I modified natspline_coeff for this function [a,b,c,d]=nakspline_coeff(knots,data); %% function [a,b,c,d]=nakspline_coeff(knots,data); %% Modification of the natural spline code spline_coeff to give %% TheNot-A-Knot spline for interpolating data at the knots a=x<...<x_n=b; %% System of equations is solved using the tridiagonal nature %% WARNING: THIS PROGRAM REQUIRES AT LEAST 4 KNOTS %% INPUT: %% knots - distinct points (t_j) of interpolation as a row vector %% data - data at the interpolation points as a row vector %% OUTPUT: %% a - column vector of constant terms for the spline on [t_j,t_(j+)] %% b - column vector of coefficients of x-t_j for the spline on [t_j,t_(j+)] %% c - column vector of coefficients of (x-t_j)^ for the spline on [t_j,t_(j+)] %% d - column vector of coefficients of (x-t_j)^ for the spline on [t_j,t_(j+)] % determine lengths of the intervals n=length(knots)-; for j=:n; h(j)=knots(j+)-knots(j)

3 % determine the right hand side of the system for i=:n-; rhs(i)=6*((data(i+)-data(i+))/h(i+)-(data(i+)-data(i))/h(i)) % solve the system using tri_diag.m dd()=*h()+*h()+h()^/h();dd(:n-)=*(h(:n-)+h(:n-)); dd(n-)=(*h(n-)+*h(n)+h(n)^/h(n-)); subd=[h(:n-),h(n-)-h(n)^/h(n-)];supd=[h()-h()^/h(),h(:n-)]; z(:n)=tri_diag(dd,subd,supd,rhs(:n-)); z()=z()-h()*(z()-z())/h();z(n+)=z(n)+h(n)*(z(n)-z(n-))/h(n-); % find the other coefficients for j=:n; b(j,)=(data(j+)-data(j))/h(j) - h(j)*(z(j+)+*z(j))/6; d(j,)=(z(j+)-z(j))/(6*h(j)); a=data(:n) ; c=z(:n) /; %Using this to find the coefficients [a,b,c,d]=nakspline_coeff(xk,yk ) a = b = c = d = ynak=spline_eval(a,b,c,d,xk,x); %p95 # (a) Clamped Spline f=@(x) cos(x.^); df=@(x) -*x*sin(x.^); xk=[,sqrt(pi/),sqrt(*pi/),sqrt(5*pi/)]; yk=f(xk); dfa=df(xk());dfb=df(xk(4)); S=csfit(xk,yk,dfa,dfb); S = xx=:.: sqrt(5*pi/); yy=spline_eval(s(:,4),s(:,),s(:,),s(:,),xk,xx); plot(xk,yk, o,xx,yy,xx,f(xx)); % (b) Natural spline [a,b,c,d]=natspline_coeff(xk,yk )

4 a =.. -. b = c = d = natyy=spline_eval(a,b,c,d,xk,xx); plot(xk,yk, o,xx,natyy,xx,f(xx)); % see below Figure : The clamped spline of problem 4 p95 on the left and the natural spline of problem 5 p95 on the right Figure : The clamped spline of problem a p95 on the left and the natural spline of problem b p95 on the right. Since the spline problem was laid out for you in Matlab, here is how it should have looked with the figures. xti=585+[:49]*; 4

5 yti=[ ]; yti=[ yti ]; %Plotting the points, see below plot(xti,yti,o) %Computing the interpolating polynomial xx=xti():.:xti(49); ypoly=int_poly(yti,xti,xx); %see int_poly.m for how data is input plot(xx,ypoly,xti,yti,o) %plot below % It is way off near the ends %Computing the natural spline interpolant [a,b,c,d]=spline_coeff(xti,yti);% see spline_coeff.m ynatspl=spline_eval(a,b,c,d,xti,xx); % see spline_coeff.m plot(xx,ynatspl,xti,yti,o) %plot below MUCH BETTER %A comparison where we interpolate at fewer points knots=xti(:6:49); data=yti(:6:49); yyintpoly=int_poly(data,knots,xx); [a,b,c,d]=spline_coeff(knots,data); yynatspl=spline_eval(a,b,c,d,knots,xx); plot(xx,yyintpoly,xti,yti,o,xx,yynatspl) %See plot below %Again, the spline is very much better. %Computing error estimates max(abs(yti-int_poly(data,knots,xti))) ans = max(abs(yti-spline_eval(a,b,c,d,knots,xti))) ans = % and the least squares error sum(abs(yti-int_poly(data,knots,xti)).^) ans = sum(abs(yti-spline_eval(a,b,c,d,knots,xti)).^) ans = % The spline is superior in both cases. % Looking for a true least squares approximation by splines % First discover the B-spline basis of independent functions % Setting up the knots knots=[knots(),knots(),knots(),knots(),knots()]; knots=[knots(),knots(),knots(),knots(),knots()]; knots=[knots(),knots(),knots(),knots(),knots(4)]; knots4=[knots(),knots(),knots(),knots(4),knots(5)]; knots5=[knots(),knots(),knots(4),knots(5),knots(6)]; 5

6 knots6=[knots(),knots(4),knots(5),knots(6),knots(7)]; knots7=[knots(4),knots(5),knots(6),knots(7),knots(8)]; knots8=[knots(5),knots(6),knots(7),knots(8),knots(9)]; knots9=[knots(6),knots(7),knots(8),knots(9),knots(9)]; knots=[knots(7),knots(8),knots(9),knots(9),knots(9)]; knots=[knots(8),knots(9),knots(9),knots(9),knots(9)]; %Using the program cubicbspl that gives the B-spline based on the knots cubicbspl(knots,x); cubicbspl(knots,x); cubicbspl(knots,x); cubicbspl(knots4,x); cubicbspl(knots5,x); cubicbspl(knots6,x); cubicbspl(knots7,x); cubicbspl(knots8,x); cubicbspl(knots9,x); cubicbspl(knots,x); cubicbspl(knots,x); % Plot the B-splines to get a better feel for them plot(xx,f(xx),xx,f(xx),xx,f(xx),xx,f4(xx),xx,f5(xx),xx,f6(xx),xx,f7(xx),xx,f8(xx),xx,f9(xx),xx,f(xx % see below %Plot the sum to show that the sum of the B-splines is identically (not much to see!). sumbsplines= f(xx)+f(xx)+f(xx)+f4(xx)+f5(xx)+f6(xx)+f7(xx)+f8(xx)+f9(xx)+f(xx)+f(xx); plot(xx,sumbsplines) max(sumbsplines) ans =.8 %small round off error min(sumbsplines) ans = %well, not quite % Doing the least squares fit using the B-splines as the linearly independent functions F=@(x) [f(x);f(x);f(x);f4(x);f5(x);f6(x);f7(x);f8(x);f9(x);f(x);f(x)]; FC=[]; for j=:49; y=f(xti(j));fc=[fc;y]; FC %This gives the matrix called F in the book and F_C in class. FR=FC; %its transpose B=FR*yti; %The right hand side of the matrix form of the system of normal equations for least squares ap FRFC=FR*FC %The coefficient matrix in the matrix form of the system of normal equations for least square %Notice that it has a banded property. This is because of the short support of the B-splines. FRFC = Columns through

7 Columns 5 through Columns 9 through C=FRFC\B %This uses Matlab to solve the system C = bestlsspline=@(x) C()*f(x)+C()*f(x)+C()*f(x)+C(4)*f4(x)+C(5)*f5(x)+C(6)*f6(x)+C(7)*f7(x)+... C(8)*f8(x)+C(9)*f9(x)+C()*f(x)+C()*f(x); % Making the best linear combination of the basis 7

8 plot(xx,bestlsspline(xx),xti,yti,o) %plot the best least square spline fit with the data See below %%Plotting the natural spline and the best least squares spline and comparing errors plot(xx,bestlsspline(xx),xti,yti,o,xx,yynatspl) spl_intxti=spline_eval(a,b,c,d,knots,xti); %evluate the natural spline interpolant at the data points ls_spl_xti=bestlsspline(xti); %evaluate the best least squares spline at all the data points sum((spl_intxti-yti).^) %least squares error of the natural spline interpolant ans = sum((ls_spl_xti-yti).^) %least squares error of the best least squares spline (its better of course:) ans = max(abs(spl_intxti-yti)) % max abs value error for the natural spline interpolant ans = max(abs(ls_spl_xti-yti)) %max abs value error for the least squares spline (again better) ans = x Figure : The titanium data on the left and the same data with its interpolating polynomial on the right Figure 4: The natural spline interpolation of the titanium data on the left. The natural spline and the polynomial that interpolates the data at every 6th data point on the right. 8

9 Figure 5: The cubic B-splines on the left the left and their sum on the interval on the right Figure 6: The best least squares approximation to the titanium data using the B-splines on the left. The natural spline interpolant on every 6th point plotted with the best least squares approximation by cubic splines on the same knot set on the right. 9

Homework #6 Brief Solutions 2012

Homework #6 Brief Solutions 2012 Homework #6 Brief Solutions %page 95 problem 4 data=[-,;-,;,;4,] data = - - 4 xk=data(:,);yk=data(:,);s=csfit(xk,yk,-,) %Using the program to find the coefficients S =.456 -.456 -.. -.5.9 -.5484. -.58.87.

More information

Runge Example Revisited for Splines

Runge Example Revisited for Splines Runge Example Revisited for Splines The Runge function f(x) = +25x on [, ] provided an very nice function that was not wellapproximated by its polynomials of interpolation. In fact, a higher degree (more

More information

Handout 4 - Interpolation Examples

Handout 4 - Interpolation Examples Handout 4 - Interpolation Examples Middle East Technical University Example 1: Obtaining the n th Degree Newton s Interpolating Polynomial Passing through (n+1) Data Points Obtain the 4 th degree Newton

More information

Math 226A Homework 4 Due Monday, December 11th

Math 226A Homework 4 Due Monday, December 11th Math 226A Homework 4 Due Monday, December 11th 1. (a) Show that the polynomial 2 n (T n+1 (x) T n 1 (x)), is the unique monic polynomial of degree n + 1 with roots at the Chebyshev points x k = cos ( )

More information

Interpolation & Polynomial Approximation. Cubic Spline Interpolation II

Interpolation & Polynomial Approximation. Cubic Spline Interpolation II Interpolation & Polynomial Approximation Cubic Spline Interpolation II Numerical Analysis (9th Edition) R L Burden & J D Faires Beamer Presentation Slides prepared by John Carroll Dublin City University

More information

Cubic spline interpolation

Cubic spline interpolation Cubic spline interpolation In the following, we want to derive the collocation matrix for cubic spline interpolation. Let us assume that we have equidistant knots. To fulfill the Schoenberg-Whitney condition

More information

See the course website for important information about collaboration and late policies, as well as where and when to turn in assignments.

See the course website for important information about collaboration and late policies, as well as where and when to turn in assignments. COS Homework # Due Tuesday, February rd See the course website for important information about collaboration and late policies, as well as where and when to turn in assignments. Data files The questions

More information

APPM/MATH Problem Set 4 Solutions

APPM/MATH Problem Set 4 Solutions APPM/MATH 465 Problem Set 4 Solutions This assignment is due by 4pm on Wednesday, October 16th. You may either turn it in to me in class on Monday or in the box outside my office door (ECOT 35). Minimal

More information

Piecewise Polynomial Interpolation, cont d

Piecewise Polynomial Interpolation, cont d Jim Lambers MAT 460/560 Fall Semester 2009-0 Lecture 2 Notes Tese notes correspond to Section 4 in te text Piecewise Polynomial Interpolation, cont d Constructing Cubic Splines, cont d Having determined

More information

Natural Quartic Spline

Natural Quartic Spline Natural Quartic Spline Rafael E Banchs INTRODUCTION This report describes the natural quartic spline algorithm developed for the enhanced solution of the Time Harmonic Field Electric Logging problem As

More information

Four equations are necessary to evaluate these coefficients. Eqn

Four equations are necessary to evaluate these coefficients. Eqn 1.2 Splines 11 A spline function is a piecewise defined function with certain smoothness conditions [Cheney]. A wide variety of functions is potentially possible; polynomial functions are almost exclusively

More information

February 2017 (1/20) 2 Piecewise Polynomial Interpolation 2.2 (Natural) Cubic Splines. MA378/531 Numerical Analysis II ( NA2 )

February 2017 (1/20) 2 Piecewise Polynomial Interpolation 2.2 (Natural) Cubic Splines. MA378/531 Numerical Analysis II ( NA2 ) f f f f f (/2).9.8.7.6.5.4.3.2. S Knots.7.6.5.4.3.2. 5 5.2.8.6.4.2 S Knots.2 5 5.9.8.7.6.5.4.3.2..9.8.7.6.5.4.3.2. S Knots 5 5 S Knots 5 5 5 5.35.3.25.2.5..5 5 5.6.5.4.3.2. 5 5 4 x 3 3.5 3 2.5 2.5.5 5

More information

Lecture 8. Divided Differences,Least-Squares Approximations. Ceng375 Numerical Computations at December 9, 2010

Lecture 8. Divided Differences,Least-Squares Approximations. Ceng375 Numerical Computations at December 9, 2010 Lecture 8, Ceng375 Numerical Computations at December 9, 2010 Computer Engineering Department Çankaya University 8.1 Contents 1 2 3 8.2 : These provide a more efficient way to construct an interpolating

More information

Polynomials tend to oscillate (wiggle) a lot, even when our true function does not.

Polynomials tend to oscillate (wiggle) a lot, even when our true function does not. AMSC/CMSC 460 Computational Methods, Fall 2007 UNIT 2: Spline Approximations Dianne P O Leary c 2001, 2002, 2007 Piecewise polynomial interpolation Piecewise polynomial interpolation Read: Chapter 3 Skip:

More information

ME 261: Numerical Analysis Lecture-12: Numerical Interpolation

ME 261: Numerical Analysis Lecture-12: Numerical Interpolation 1 ME 261: Numerical Analysis Lecture-12: Numerical Interpolation Md. Tanver Hossain Department of Mechanical Engineering, BUET http://tantusher.buet.ac.bd 2 Inverse Interpolation Problem : Given a table

More information

Interpolation. TANA09 Lecture 7. Error analysis for linear interpolation. Linear Interpolation. Suppose we have a table x x 1 x 2...

Interpolation. TANA09 Lecture 7. Error analysis for linear interpolation. Linear Interpolation. Suppose we have a table x x 1 x 2... TANA9 Lecture 7 Interpolation Suppose we have a table x x x... x n+ Interpolation Introduction. Polynomials. Error estimates. Runge s phenomena. Application - Equation solving. Spline functions and interpolation.

More information

Consider functions such that then satisfies these properties: So is represented by the cubic polynomials on on and on.

Consider functions such that then satisfies these properties: So is represented by the cubic polynomials on on and on. 1 of 9 3/1/2006 2:28 PM ne previo Next: Trigonometric Interpolation Up: Spline Interpolation Previous: Piecewise Linear Case Cubic Splines A piece-wise technique which is very popular. Recall the philosophy

More information

lecture 10: B-Splines

lecture 10: B-Splines 9 lecture : -Splines -Splines: a basis for splines Throughout our discussion of standard polynomial interpolation, we viewed P n as a linear space of dimension n +, and then expressed the unique interpolating

More information

Handout 2 - Root Finding using MATLAB

Handout 2 - Root Finding using MATLAB Handout 2 - Root Finding using MATLAB Middle East Technical University MATLAB has couple of built-in root finding functions. In this handout we ll have a look at fzero, roots and solve functions. It is

More information

MATLAB NOTES. Matlab designed for numerical computing. Strongly oriented towards use of arrays, one and two dimensional.

MATLAB NOTES. Matlab designed for numerical computing. Strongly oriented towards use of arrays, one and two dimensional. MATLAB NOTES Matlab designed for numerical computing. Strongly oriented towards use of arrays, one and two dimensional. Excellent graphics that are easy to use. Powerful interactive facilities; and programs

More information

8 Piecewise Polynomial Interpolation

8 Piecewise Polynomial Interpolation Applied Math Notes by R. J. LeVeque 8 Piecewise Polynomial Interpolation 8. Pitfalls of high order interpolation Suppose we know the value of a function at several points on an interval and we wish to

More information

Matlab and Octave: Quick Introduction and Examples 1 Basics

Matlab and Octave: Quick Introduction and Examples 1 Basics Matlab and Octave: Quick Introduction and Examples 1 Basics 1.1 Syntax and m-files There is a shell where commands can be written in. All commands must either be built-in commands, functions, names of

More information

Computational Physics PHYS 420

Computational Physics PHYS 420 Computational Physics PHYS 420 Dr Richard H. Cyburt Assistant Professor of Physics My office: 402c in the Science Building My phone: (304) 384-6006 My email: rcyburt@concord.edu My webpage: www.concord.edu/rcyburt

More information

Cubic Splines and Matlab

Cubic Splines and Matlab Cubic Splines and Matlab October 7, 2006 1 Introduction In this section, we introduce the concept of the cubic spline, and how they are implemented in Matlab. Of particular importance are the new Matlab

More information

Linear Interpolating Splines

Linear Interpolating Splines Jim Lambers MAT 772 Fall Semester 2010-11 Lecture 17 Notes Tese notes correspond to Sections 112, 11, and 114 in te text Linear Interpolating Splines We ave seen tat ig-degree polynomial interpolation

More information

[100] 091 News, Tutorial by Dec. 10, 2012 =======================================

[100] 091 News, Tutorial by  Dec. 10, 2012 ======================================= [100] 091 revised on 2012.12.10 cemmath The Simple is the Best News Dec. 10, 2012 ======================================= Cemmath 2.22 (a new name of Msharpmath) is newly upgraded. indefinite integrals

More information

Concept of Curve Fitting Difference with Interpolation

Concept of Curve Fitting Difference with Interpolation Curve Fitting Content Concept of Curve Fitting Difference with Interpolation Estimation of Linear Parameters by Least Squares Curve Fitting by Polynomial Least Squares Estimation of Non-linear Parameters

More information

Splines. Parameterization of a Curve. Curve Representations. Roller coaster. What Do We Need From Curves in Computer Graphics? Modeling Complex Shapes

Splines. Parameterization of a Curve. Curve Representations. Roller coaster. What Do We Need From Curves in Computer Graphics? Modeling Complex Shapes CSCI 420 Computer Graphics Lecture 8 Splines Jernej Barbic University of Southern California Hermite Splines Bezier Splines Catmull-Rom Splines Other Cubic Splines [Angel Ch 12.4-12.12] Roller coaster

More information

Cubic Spline Questions

Cubic Spline Questions Cubic Spline Questions. Find natural cubic splines which interpolate the following dataset of, points:.0,.,.,.0, 7.0,.,.0,0.; estimate the value for. Solution: Step : Use the n- cubic spline equations

More information

Friday, 11 January 13. Interpolation

Friday, 11 January 13. Interpolation Interpolation Interpolation Interpolation is not a branch of mathematic but a collection of techniques useful for solving computer graphics problems Basically an interpolant is a way of changing one number

More information

Assignment 2. with (a) (10 pts) naive Gauss elimination, (b) (10 pts) Gauss with partial pivoting

Assignment 2. with (a) (10 pts) naive Gauss elimination, (b) (10 pts) Gauss with partial pivoting Assignment (Be sure to observe the rules about handing in homework). Solve: with (a) ( pts) naive Gauss elimination, (b) ( pts) Gauss with partial pivoting *You need to show all of the steps manually.

More information

Math F302: Octave Miscellany September 28, e 1 x3 dx. Here s how to find a numerical approximation with Octave

Math F302: Octave Miscellany September 28, e 1 x3 dx. Here s how to find a numerical approximation with Octave Definite Integrals Despite your training in Calculus, most definite integrals cannot be computed exactly, and must be approximated numerically. You learned a number of rules for doing this: the trapezoidal

More information

A Brief Introduction to MATLAB

A Brief Introduction to MATLAB A Brief Introduction to MATLAB MATLAB (Matrix Laboratory) is an interactive software system for numerical computations and graphics. As the name suggests, MATLAB was first designed for matrix computations:

More information

Fall CSCI 420: Computer Graphics. 4.2 Splines. Hao Li.

Fall CSCI 420: Computer Graphics. 4.2 Splines. Hao Li. Fall 2014 CSCI 420: Computer Graphics 4.2 Splines Hao Li http://cs420.hao-li.com 1 Roller coaster Next programming assignment involves creating a 3D roller coaster animation We must model the 3D curve

More information

Splines and Piecewise Interpolation. Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan

Splines and Piecewise Interpolation. Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan Splines and Piecewise Interpolation Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan chanhl@mail.cgu.edu.tw Splines n 1 intervals and n data points 2 Splines (cont.) Go through

More information

From: Robert Sharpley Subject: Homeworks #6 Date: February 22, :09:53 AM EST Cc: Robert Sharpley

From: Robert Sharpley Subject: Homeworks #6 Date: February 22, :09:53 AM EST Cc: Robert Sharpley From: Robert Sharpley Subject: Homeworks #6 Date: February 22, 2006 9:09:53 AM EST Cc: Robert Sharpley %% Homework #5 - Solutions %% Here is a matlab code

More information

and r 23 e iθ 23 function [CornersFound] = FindCorners(x,y,threshhold,closed)

and r 23 e iθ 23 function [CornersFound] = FindCorners(x,y,threshhold,closed) Math 28a - Programming Project 2 - Answers We provide. our implementations of the subroutines you had to supply, 2. a discussion of periodic splines, and 3. outputs and discussion. FindCorners.m is self-explanatory.

More information

Interpolation by Spline Functions

Interpolation by Spline Functions Interpolation by Spline Functions Com S 477/577 Sep 0 007 High-degree polynomials tend to have large oscillations which are not the characteristics of the original data. To yield smooth interpolating curves

More information

Justify all your answers and write down all important steps. Unsupported answers will be disregarded.

Justify all your answers and write down all important steps. Unsupported answers will be disregarded. Numerical Analysis FMN011 2017/05/30 The exam lasts 5 hours and has 15 questions. A minimum of 35 points out of the total 70 are required to get a passing grade. These points will be added to those you

More information

MATH 51: MATLAB HOMEWORK 3

MATH 51: MATLAB HOMEWORK 3 MATH 5: MATLAB HOMEWORK Experimental data generally suffers from imprecision, though frequently one can predict how data should behave by graphing results collected from experiments. For instance, suppose

More information

Set 5, Total points: 100 Issued: week of

Set 5, Total points: 100 Issued: week of Prof. P. Koumoutsakos Prof. Dr. Jens Walther ETH Zentrum, CLT F 1, E 11 CH-809 Zürich Models, Algorithms and Data (MAD): Introduction to Computing Spring semester 018 Set 5, Total points: 100 Issued: week

More information

Maximizing an interpolating quadratic

Maximizing an interpolating quadratic Week 11: Monday, Apr 9 Maximizing an interpolating quadratic Suppose that a function f is evaluated on a reasonably fine, uniform mesh {x i } n i=0 with spacing h = x i+1 x i. How can we find any local

More information

Math Numerical Analysis

Math Numerical Analysis ... Math 541 - Numerical Analysis Interpolation and Polynomial Approximation Piecewise Polynomial Approximation; Joseph M. Mahaffy, jmahaffy@mail.sdsu.edu Department of Mathematics and Statistics Dynamical

More information

Vector: A series of scalars contained in a column or row. Dimensions: How many rows and columns a vector or matrix has.

Vector: A series of scalars contained in a column or row. Dimensions: How many rows and columns a vector or matrix has. ASSIGNMENT 0 Introduction to Linear Algebra (Basics of vectors and matrices) Due 3:30 PM, Tuesday, October 10 th. Assignments should be submitted via e-mail to: matlabfun.ucsd@gmail.com You can also submit

More information

Chapter 19 Interpolation

Chapter 19 Interpolation 19.1 One-Dimensional Interpolation Chapter 19 Interpolation Empirical data obtained experimentally often times conforms to a fixed (deterministic) but unkown functional relationship. When estimates of

More information

Polynomial Functions Graphing Investigation Unit 3 Part B Day 1. Graph 1: y = (x 1) Graph 2: y = (x 1)(x + 2) Graph 3: y =(x 1)(x + 2)(x 3)

Polynomial Functions Graphing Investigation Unit 3 Part B Day 1. Graph 1: y = (x 1) Graph 2: y = (x 1)(x + 2) Graph 3: y =(x 1)(x + 2)(x 3) Part I: Polynomial Functions when a = 1 Directions: Polynomial Functions Graphing Investigation Unit 3 Part B Day 1 1. For each set of factors, graph the zeros first, then use your calculator to determine

More information

MATLAB QUICK START TUTORIAL

MATLAB QUICK START TUTORIAL MATLAB QUICK START TUTORIAL This tutorial is a brief introduction to MATLAB which is considered one of the most powerful languages of technical computing. In the following sections, the basic knowledge

More information

1) Generate a vector of the even numbers between 5 and 50.

1) Generate a vector of the even numbers between 5 and 50. MATLAB Sheet 1) Generate a vector of the even numbers between 5 and 50. 2) Let x = [3 5 4 2 8 9]. a) Add 20 to each element. b) Subtract 2 from each element. c) Add 3 to just the odd index elements. d)

More information

Module 1: Introduction to Finite Difference Method and Fundamentals of CFD Lecture 6:

Module 1: Introduction to Finite Difference Method and Fundamentals of CFD Lecture 6: file:///d:/chitra/nptel_phase2/mechanical/cfd/lecture6/6_1.htm 1 of 1 6/20/2012 12:24 PM The Lecture deals with: ADI Method file:///d:/chitra/nptel_phase2/mechanical/cfd/lecture6/6_2.htm 1 of 2 6/20/2012

More information

Polymath 6. Overview

Polymath 6. Overview Polymath 6 Overview Main Polymath Menu LEQ: Linear Equations Solver. Enter (in matrix form) and solve a new system of simultaneous linear equations. NLE: Nonlinear Equations Solver. Enter and solve a new

More information

Introduction to MATLAB 7 for Engineers

Introduction to MATLAB 7 for Engineers PowerPoint to accompany Introduction to MATLAB 7 for Engineers William J. Palm III Chapter 2 Numeric, Cell, and Structure Arrays Copyright 2005. The McGraw-Hill Companies, Inc. Permission required for

More information

UNIVERSITY OF CALIFORNIA COLLEGE OF ENGINEERING

UNIVERSITY OF CALIFORNIA COLLEGE OF ENGINEERING UNIVERSITY OF CALIFORNIA COLLEGE OF ENGINEERING E7: INTRODUCTION TO COMPUTER PROGRAMMING FOR SCIENTISTS AND ENGINEERS Professor Raja Sengupta Spring 2010 Second Midterm Exam April 14, 2010 [30 points ~

More information

Part III Functions and Data

Part III Functions and Data Part III Functions and Data c Copyright, Todd Young and Martin Mohlenkamp, Mathematics Department, Ohio University, 2017 Lecture 19 Polynomial and Spline Interpolation A Chemical Reaction In a chemical

More information

3.2 - Interpolation and Lagrange Polynomials

3.2 - Interpolation and Lagrange Polynomials 3. - Interpolation and Lagrange Polynomials. Polynomial Interpolation: Problem: Givenn pairs of data points x i, y i,wherey i fx i, i 0,,...,n for some function fx, we want to find a polynomial P x of

More information

Master Thesis. Comparison and Evaluation of Didactic Methods in Numerical Analysis for the Teaching of Cubic Spline Interpolation

Master Thesis. Comparison and Evaluation of Didactic Methods in Numerical Analysis for the Teaching of Cubic Spline Interpolation Master Thesis Comparison and Evaluation of Didactic Methods in Numerical Analysis for the Teaching of Cubic Spline Interpolation Abtihal Jaber Chitheer supervised by Prof. Dr. Carmen Arévalo May 17, 2017

More information

Need for Parametric Equations

Need for Parametric Equations Curves and Surfaces Curves and Surfaces Need for Parametric Equations Affine Combinations Bernstein Polynomials Bezier Curves and Surfaces Continuity when joining curves B Spline Curves and Surfaces Need

More information

LECTURE NOTES - SPLINE INTERPOLATION. 1. Introduction. Problems can arise when a single high-degree polynomial is fit to a large number

LECTURE NOTES - SPLINE INTERPOLATION. 1. Introduction. Problems can arise when a single high-degree polynomial is fit to a large number LECTURE NOTES - SPLINE INTERPOLATION DR MAZHAR IQBAL 1 Introduction Problems can arise when a single high-degree polynomial is fit to a large number of points High-degree polynomials would obviously pass

More information

Course Number 432/433 Title Algebra II (A & B) H Grade # of Days 120

Course Number 432/433 Title Algebra II (A & B) H Grade # of Days 120 Whitman-Hanson Regional High School provides all students with a high- quality education in order to develop reflective, concerned citizens and contributing members of the global community. Course Number

More information

An Introduction to Numerical Methods

An Introduction to Numerical Methods An Introduction to Numerical Methods Using MATLAB Khyruddin Akbar Ansari, Ph.D., P.E. Bonni Dichone, Ph.D. SDC P U B L I C AT I O N S Better Textbooks. Lower Prices. www.sdcpublications.com Powered by

More information

Math 3 Coordinate Geometry Part 2 Graphing Solutions

Math 3 Coordinate Geometry Part 2 Graphing Solutions Math 3 Coordinate Geometry Part 2 Graphing Solutions 1 SOLVING SYSTEMS OF EQUATIONS GRAPHICALLY The solution of two linear equations is the point where the two lines intersect. For example, in the graph

More information

Remark. Jacobs University Visualization and Computer Graphics Lab : ESM4A - Numerical Methods 331

Remark. Jacobs University Visualization and Computer Graphics Lab : ESM4A - Numerical Methods 331 Remark Reconsidering the motivating example, we observe that the derivatives are typically not given by the problem specification. However, they can be estimated in a pre-processing step. A good estimate

More information

Engineering Analysis ENG 3420 Fall Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00

Engineering Analysis ENG 3420 Fall Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00 Engineering Analysis ENG 3420 Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00 1 Lecture 24 Attention: The last homework HW5 and the last project are due on Tuesday November

More information

Table for Third-Degree Spline Interpolation Using Equi-Spaced Knots. By W. D. Hoskins

Table for Third-Degree Spline Interpolation Using Equi-Spaced Knots. By W. D. Hoskins MATHEMATICS OF COMPUTATION, VOLUME 25, NUMBER 116, OCTOBER, 1971 Table for Third-Degree Spline Interpolation Using Equi-Spaced Knots By W. D. Hoskins Abstract. A table is given for the calculation of the

More information

Mid-Chapter Quiz: Lessons 2-1 through 2-3

Mid-Chapter Quiz: Lessons 2-1 through 2-3 Graph and analyze each function. Describe its domain, range, intercepts, end behavior, continuity, and where the function is increasing or decreasing. 1. f (x) = 2x 3 2 16 1.5 6.75 1 2 0 0 1 2 1.5 6.75

More information

Cubic smoothing spline

Cubic smoothing spline Cubic smooting spline Menu: QCExpert Regression Cubic spline e module Cubic Spline is used to fit any functional regression curve troug data wit one independent variable x and one dependent random variable

More information

Fondamenti di Informatica

Fondamenti di Informatica Fondamenti di Informatica Scripts and Functions: examples lesson 9 2012/04/16 Prof. Emiliano Casalicchio emiliano.casalicchio@uniroma2.it Agenda Examples Bisection method Locating roots Secant methods

More information

Lecture 9. Curve fitting. Interpolation. Lecture in Numerical Methods from 28. April 2015 UVT. Lecture 9. Numerical. Interpolation his o

Lecture 9. Curve fitting. Interpolation. Lecture in Numerical Methods from 28. April 2015 UVT. Lecture 9. Numerical. Interpolation his o Curve fitting. Lecture in Methods from 28. April 2015 to ity Interpolation FIGURE A S Splines Piecewise relat UVT Agenda of today s lecture 1 Interpolation Idea 2 3 4 5 6 Splines Piecewise Interpolation

More information

MATLAB Examples. Interpolation and Curve Fitting. Hans-Petter Halvorsen

MATLAB Examples. Interpolation and Curve Fitting. Hans-Petter Halvorsen MATLAB Examples Interpolation and Curve Fitting Hans-Petter Halvorsen Interpolation Interpolation is used to estimate data points between two known points. The most common interpolation technique is Linear

More information

The use of the Spectral Properties of the Basis Splines in Problems of Signal Processing

The use of the Spectral Properties of the Basis Splines in Problems of Signal Processing The use of the Spectral Properties of the Basis Splines in Problems of Signal Processing Zaynidinov Hakim Nasiritdinovich, MirzayevAvazEgamberdievich, KhalilovSirojiddinPanjievich Doctor of Science, professor,

More information

Interpolation and Splines

Interpolation and Splines Interpolation and Splines Anna Gryboś October 23, 27 1 Problem setting Many of physical phenomenona are described by the functions that we don t know exactly. Often we can calculate or measure the values

More information

MATLAB Modul 3. Introduction

MATLAB Modul 3. Introduction MATLAB Modul 3 Introduction to Computational Science: Modeling and Simulation for the Sciences, 2 nd Edition Angela B. Shiflet and George W. Shiflet Wofford College 2014 by Princeton University Press Introduction

More information

Introduction to MATLAB for Engineers, Third Edition

Introduction to MATLAB for Engineers, Third Edition PowerPoint to accompany Introduction to MATLAB for Engineers, Third Edition William J. Palm III Chapter 2 Numeric, Cell, and Structure Arrays Copyright 2010. The McGraw-Hill Companies, Inc. This work is

More information

An introduction to interpolation and splines

An introduction to interpolation and splines An introduction to interpolation and splines Kenneth H. Carpenter, EECE KSU November 22, 1999 revised November 20, 2001, April 24, 2002, April 14, 2004 1 Introduction Suppose one wishes to draw a curve

More information

University of Alberta

University of Alberta A Brief Introduction to MATLAB University of Alberta M.G. Lipsett 2008 MATLAB is an interactive program for numerical computation and data visualization, used extensively by engineers for analysis of systems.

More information

Polynomial Approximation and Interpolation Chapter 4

Polynomial Approximation and Interpolation Chapter 4 4.4 LAGRANGE POLYNOMIALS The direct fit polynomial presented in Section 4.3, while quite straightforward in principle, has several disadvantages. It requires a considerable amount of effort to solve the

More information

Variable Definition and Statement Suppression You can create your own variables, and assign them values using = >> a = a = 3.

Variable Definition and Statement Suppression You can create your own variables, and assign them values using = >> a = a = 3. MATLAB Introduction Accessing Matlab... Matlab Interface... The Basics... 2 Variable Definition and Statement Suppression... 2 Keyboard Shortcuts... More Common Functions... 4 Vectors and Matrices... 4

More information

Fitting to a set of data. Lecture on fitting

Fitting to a set of data. Lecture on fitting Fitting to a set of data Lecture on fitting Linear regression Linear regression Residual is the amount difference between a real data point and a modeled data point Fitting a polynomial to data Could use

More information

(Creating Arrays & Matrices) Applied Linear Algebra in Geoscience Using MATLAB

(Creating Arrays & Matrices) Applied Linear Algebra in Geoscience Using MATLAB Applied Linear Algebra in Geoscience Using MATLAB (Creating Arrays & Matrices) Contents Getting Started Creating Arrays Mathematical Operations with Arrays Using Script Files and Managing Data Two-Dimensional

More information

Prof. Manoochehr Shirzaei. RaTlab.asu.edu

Prof. Manoochehr Shirzaei. RaTlab.asu.edu RaTlab.asu.edu Introduction To MATLAB Introduction To MATLAB This lecture is an introduction of the basic MATLAB commands. We learn; Functions Procedures for naming and saving the user generated files

More information

FreeMat Tutorial. 3x + 4y 2z = 5 2x 5y + z = 8 x x + 3y = -1 xx

FreeMat Tutorial. 3x + 4y 2z = 5 2x 5y + z = 8 x x + 3y = -1 xx 1 of 9 FreeMat Tutorial FreeMat is a general purpose matrix calculator. It allows you to enter matrices and then perform operations on them in the same way you would write the operations on paper. This

More information

Points Lines Connected points X-Y Scatter. X-Y Matrix Star Plot Histogram Box Plot. Bar Group Bar Stacked H-Bar Grouped H-Bar Stacked

Points Lines Connected points X-Y Scatter. X-Y Matrix Star Plot Histogram Box Plot. Bar Group Bar Stacked H-Bar Grouped H-Bar Stacked Plotting Menu: QCExpert Plotting Module graphs offers various tools for visualization of uni- and multivariate data. Settings and options in different types of graphs allow for modifications and customizations

More information

Performing Matrix Operations on the TI-83/84

Performing Matrix Operations on the TI-83/84 Page1 Performing Matrix Operations on the TI-83/84 While the layout of most TI-83/84 models are basically the same, of the things that can be different, one of those is the location of the Matrix key.

More information

Interactive Graphics. Lecture 9: Introduction to Spline Curves. Interactive Graphics Lecture 9: Slide 1

Interactive Graphics. Lecture 9: Introduction to Spline Curves. Interactive Graphics Lecture 9: Slide 1 Interactive Graphics Lecture 9: Introduction to Spline Curves Interactive Graphics Lecture 9: Slide 1 Interactive Graphics Lecture 13: Slide 2 Splines The word spline comes from the ship building trade

More information

THE STUDY OF NEW APPROACHES IN CUBIC SPLINE INTERPOLATION FOR AUTO MOBILE DATA

THE STUDY OF NEW APPROACHES IN CUBIC SPLINE INTERPOLATION FOR AUTO MOBILE DATA Journal of Science and Arts Year 17, No. 3(4), pp. 41-46, 217 ORIGINAL PAPER THE STUDY OF NEW APPROACHES IN CUBIC SPLINE INTERPOLATION FOR AUTO MOBILE DATA NAJMUDDIN AHMAD 1, KHAN FARAH DEEBA 1 Manuscript

More information

4.3 Quadratic functions and their properties

4.3 Quadratic functions and their properties 4.3 Quadratic functions and their properties A quadratic function is a function defined as f(x) = ax + x + c, a 0 Domain: the set of all real numers x-intercepts: Solutions of ax + x + c = 0 y-intercept:

More information

x = 12 x = 12 1x = 16

x = 12 x = 12 1x = 16 2.2 - The Inverse of a Matrix We've seen how to add matrices, multiply them by scalars, subtract them, and multiply one matrix by another. The question naturally arises: Can we divide one matrix by another?

More information

Matlab and Coordinate Systems

Matlab and Coordinate Systems Matlab and Coordinate Systems Math 45 Linear Algebra David Arnold David-Arnold@Eureka.redwoods.cc.ca.us Abstract In this exercise we will introduce the concept of a coordinate system for a vector space.

More information

ARRAY VARIABLES (ROW VECTORS)

ARRAY VARIABLES (ROW VECTORS) 11 ARRAY VARIABLES (ROW VECTORS) % Variables in addition to being singular valued can be set up as AN ARRAY of numbers. If we have an array variable as a row of numbers we call it a ROW VECTOR. You can

More information

EECS 556 Image Processing W 09. Interpolation. Interpolation techniques B splines

EECS 556 Image Processing W 09. Interpolation. Interpolation techniques B splines EECS 556 Image Processing W 09 Interpolation Interpolation techniques B splines What is image processing? Image processing is the application of 2D signal processing methods to images Image representation

More information

Introduction to Matlab

Introduction to Matlab Introduction to Matlab Enrique Muñoz Ballester Dipartimento di Informatica via Bramante 65, 26013 Crema (CR), Italy enrique.munoz@unimi.it Contact Email: enrique.munoz@unimi.it Office: Room BT-43 Industrial,

More information

Multiple-Choice Test Spline Method Interpolation COMPLETE SOLUTION SET

Multiple-Choice Test Spline Method Interpolation COMPLETE SOLUTION SET Multiple-Choice Test Spline Method Interpolation COMPLETE SOLUTION SET 1. The ollowing n data points, ( x ), ( x ),.. ( x, ) 1, y 1, y n y n quadratic spline interpolation the x-data needs to be (A) equally

More information

1 A Section A BRIEF TOUR. 1.1 Subsection Subsection 2

1 A Section A BRIEF TOUR. 1.1 Subsection Subsection 2 A BRIEF TOUR Maple V is a complete mathematical problem-solving environment that supports a wide variety of mathematical operations such as numerical analysis, symbolic algebra, and graphics. This worksheet

More information

Algebra 1. Standard 11 Operations of Expressions. Categories Combining Expressions Multiply Expressions Multiple Operations Function Knowledge

Algebra 1. Standard 11 Operations of Expressions. Categories Combining Expressions Multiply Expressions Multiple Operations Function Knowledge Algebra 1 Standard 11 Operations of Expressions Categories Combining Expressions Multiply Expressions Multiple Operations Function Knowledge Summative Assessment Date: Wednesday, February 13 th Page 1

More information

Least-Squares Fitting of Data with B-Spline Curves

Least-Squares Fitting of Data with B-Spline Curves Least-Squares Fitting of Data with B-Spline Curves David Eberly, Geometric Tools, Redmond WA 98052 https://www.geometrictools.com/ This work is licensed under the Creative Commons Attribution 4.0 International

More information

Teaching Manual Math 2131

Teaching Manual Math 2131 Math 2131 Linear Algebra Labs with MATLAB Math 2131 Linear algebra with Matlab Teaching Manual Math 2131 Contents Week 1 3 1 MATLAB Course Introduction 5 1.1 The MATLAB user interface...........................

More information

. As x gets really large, the last terms drops off and f(x) ½x

. As x gets really large, the last terms drops off and f(x) ½x Pre-AP Algebra 2 Unit 8 -Lesson 3 End behavior of rational functions Objectives: Students will be able to: Determine end behavior by dividing and seeing what terms drop out as x Know that there will be

More information

Interpolation - 2D mapping Tutorial 1: triangulation

Interpolation - 2D mapping Tutorial 1: triangulation Tutorial 1: triangulation Measurements (Zk) at irregular points (xk, yk) Ex: CTD stations, mooring, etc... The known Data How to compute some values on the regular spaced grid points (+)? The unknown data

More information

Mar. 20 Math 2335 sec 001 Spring 2014

Mar. 20 Math 2335 sec 001 Spring 2014 Mar. 20 Math 2335 sec 001 Spring 2014 Chebyshev Polynomials Definition: For an integer n 0 define the function ( ) T n (x) = cos n cos 1 (x), 1 x 1. It can be shown that T n is a polynomial of degree n.

More information

Generalised Mean Averaging Interpolation by Discrete Cubic Splines

Generalised Mean Averaging Interpolation by Discrete Cubic Splines Publ. RIMS, Kyoto Univ. 30 (1994), 89-95 Generalised Mean Averaging Interpolation by Discrete Cubic Splines By Manjulata SHRIVASTAVA* Abstract The aim of this work is to introduce for a discrete function,

More information

Hybrid Newton-Cotes Integrals

Hybrid Newton-Cotes Integrals Hybrid Newton-Cotes Integrals 1 Hybrid Newton-Cotes Integrals By Namir C. Shammas Introduction Newton-Cotes integration methods are numerical methods for integration. These methods calculate the estimate

More information