0% found this document useful (0 votes)
27 views

MATH 130 - Lab 3

This laboratory report summarizes the results of solving problems related to curve fitting and interpolation using MATLAB. The problems included Newton's polynomial interpolation, Lagrange polynomial interpolation, quadratic spline interpolation, cubic spline interpolation, and curve fitting by function approximation. Codes were written for each problem and the results were presented in figures. The report interprets the results and process for each problem solved.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views

MATH 130 - Lab 3

This laboratory report summarizes the results of solving problems related to curve fitting and interpolation using MATLAB. The problems included Newton's polynomial interpolation, Lagrange polynomial interpolation, quadratic spline interpolation, cubic spline interpolation, and curve fitting by function approximation. Codes were written for each problem and the results were presented in figures. The report interprets the results and process for each problem solved.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

MATH 130

Numerical Solutions to CE Problems


Laboratory
Group Members: Laboratory No. 3 Rating
1. Ivy Joy M.Vallejo
2. Marshall James Laboratory:
Ramirez Solving Problems
3. Angelie Lumangyao with Curve
4. Edjell Mateo Fitting and
5. Leamor C. Monilar Interpolation
Date Submitted: Using MATLAB
November 6, 2023

I. OBJECTIVE

1.Using GNU Octave/MATLAB, create a code that


would solve problems related to curve fitting
and interpolation.
2.Run the code, input the given and screenshot
the command window.
3.Produce a Laboratory Report.

II. COMPUTER PROGRAM

PROBLEM:

1. Newton's Polynomial Interpolation


Using Newton’s interpolation formula find y(1.5)from
the following table:
x 0 2 4 6
f(x) 5 29 125 341

2. Lagrange Polynomial Interpolation


Find the value of Y, when X= 140
X 110 130 160 190

Y 10.8 8.1 5.5 4.8


3. Quadratic Spline Interpolation
Find the 9 unknowns and their values.
X 2 4 6 5
F(X) 1 3 2.5 6.25

4. Cubic Spline Interpolation


X 0 1 2 3
F(X) 1 2.7 7.29 19.68

X 1 3 5 7
F(X) 2 4 6 8

5. CURVE FITTING
Determine the value of f(10) for a given set of data
below using quadratic spline interpolation.

Code for Newton's Polynomial Interpolation:


Code for Lagrange Polynomial Interpolation:

Code for Quadratic Spline Interpolation:


Code for Cubic Spline Interpolation:
CODE FOR Curve Fitting by Function Approximation

III. FIGURES
Figure 1. Results for Newton's Polynomial Interpolation

Figure 2. Results for Lagrange Polynomial Interpolation

Figure 3. Results for Quadratic Spline Interpolation


Figure 4. Results for Cubic Spline Interpolation

FIGURE 5. RESULTS FOR Curve Fitting by Function


Approximation
IV. INTERPRETATION

1. Interpretation for Newton's Polynomial Interpolation


The Newton’s Polynomial Interpolation is a
powerful method calculates an nth-degree polynomial
that passes through n+1 points. It starts with a
first-degree polynomial and then progressively adds
higher degrees to fit the given data points. The data
was given in the table consist of four points. Its
much easier to solve this problem using the MATLAB
program. Manually, it takes much longer time to it
solve. The result in manual solving is the same with
the result in the program.

2. Interpretation for Lagrange Polynomial Interpolation


In the figure no. 2 shown used a Lagrange Interpolating
polynomial, it is the unique polynomial of lowest
degree that interpolates a given set of data. Given
a data set of coordinate pairs with the are called
nodes and the are called values. The data was given
in the table shown in problem two. The code was
simple for this problem, it was easily calculated
when you input the data for the problem. However,
it was kind of challenging when you compute it
manually cause
it would take an ample of time to solve it. The result
is nearly similar to both ways of calculating.

3. Interpretation for Quadratic Spline Polynomial


Interpolation
Quadratic spline interpolation is an interpolation
method through which we can find functions to
approximate outputs based on discrete data points
through the use of quadratic polynomials. In this
case, the quadratic interpolation is solving the 9
unknowns in the given x and y values

4. Interpretation for Cubic Spline Interpolation


Curve Fitting is well-known deterministic
approach to function approximation in mathematical
fields. It is the process of constructing a curve or
mathematical function that has the best fit to series
of data points, possibly subject to constraints.
Specifically, we assume that the points (xi,yi) and
(xi+1,yi+1) are joined by a cubic polynomial
Si(x)=aix3+bix2+cix+di that is valid for xi≤x≤xi+1
for i=1,…,n−1. To find the interpolating function, we
must first determine the coefficients ai,bi,ci,di ,
for each of the cubic functions. For n points, there
are n−1 cubic functions to find, and each cubic
function requires four coefficients. Therefore, we
have a total of 4(n−1) unknowns, and so we need 4(n−1)
independent equations to find all the coefficients.
Thus, a solution is shown.

5. Interpretation for Curve Fitting by Function


Approximation

Curve fitting is the process of constructing a curve,


or mathematical function, that has the best fit to a
series of data points, possibly subject to
constraints. In this method, we used formulas
depending on the problem equation or on the give axis.
Where we solve the sum of X and Y…XY…X^2 and etc.…
In this method to solve the problem you have to input
the sum of X and Y and the other total Sum of the
table…then you’ll get the a…b…c and compute the
equation.

V. RATING
Criteria Score
Ability to prepare a well
written report
Ability to write a
computer program to solve
engineering problem.
Ability to interpret the
results correctly.

You might also like