Sem233 LA CC02 Group12
Sem233 LA CC02 Group12
Sem233 LA CC02 Group12
1
Table of contents
III.Introduction. .............................................................................................................5
IVCalculation. ................................................................................................................6
a.Interpolation ..........................................................................................................6
b.Extrapolation ........................................................................................................6
VConclusion .................................................................................................................21
2
I.Group member
No. Full Name Student ID
3
II.Job role of each members & Work evaluation.
Work
No. Name Job role
evaluation
Code MATLAB,
1 Lê Phước Thiên Duyên Rearrange the data 100%
Format, Introduction,
2 Nguyễn Huy Hoàng Theory 100%
Arrange structure of
3 Phan Quang Minh report 100%
Code MATLAB,
4 Võ Phương Hồng Ngọc Rearrange the data 100%
Arrange structure of
5 Nguyễn Tấn Phát report 100%
Coordinator,
6 Võ Minh Thăng Code MATLAB 100%
Code MATLAB,
7 Dương Anh Vinh Rearrange the data 100%
4
III.Introduction.
The purpose of this study is to highlight the importance of applying linear algebra
in analyzing and predicting the development trend of a certain entity, from which it is
possible to calculate and propose appropriate directions. appropriate while still ensuring
optimization in terms of time and cost.
In the chosen topic, we must find one practical problem and show the solution by
using the MATLAB language.
After some discussions, our group decided to choose the eighth topic:
Interpolation, Extrapolation, and climate change. Furthermore, in this report we will
illustrate the theoretical basis relating to the practical problem we collected and show
how we deal with this by using MATLAB.
5
IV.Calculation.
1.Theory and algorithm.
a.Interpolation
Definition: Within a series of known data points, researchers can estimate
unknown values using a statistical technique called interpolation.
Data Range: Interpolation projects data points inside the data range. Furthermore,
interpolation operates inside the data range of two known values.
• Someone, the data value resulting from interpolation isn’t very precise.
• It could lead to a huge margin of error in the observation.
• When applying interpolation to a large data set, you’d need to repeat several
calculations.
• It can demand lots of time and resources.
b.Extrapolation
Definition: extrapolation is a statistical method of predicting the value or state of
a variable based on its current state. In other words, the researcher studies the present
condition of a variable and uses these insights to arrive at a realistic estimation for the
future.
6
Types of extrapolations: While extrapolation passes as part of human instinct, it
requires standardized processes during research. Based on these standards, we can
identify 3 types of extrapolations - linear, conic, and polynomial.
• Linear Extrapolation:
Linear extrapolation is the process of estimating a value that is close to the existing
data. To do this, the researcher plots out a linear equation on a graph and uses the
sequence of the values to predict immediate future data points. You can draw a tangent
line at the last point and extend this line beyond the limits.
Estimates given by linear extrapolation are never as good as using equations from
the line of the best fit method.
• Conic Extrapolation:
• Polynomial Extrapolation:
Advantages of extrapolation:
• Extrapolation is a simple method of data forecasting, and it doesn’t require lots
of time or monetary resources.
7
• In human resources, extrapolation can help you determine the appropriate
compensation value for staff based on their current performance.
• Extrapolation offers an effective means for businesses to project their future
outcomes based on the current data at their disposal.
• This forecasting method has low data requirements. This means you do not
have to gather large data sets before you can predict future data points.
Disadvantages of extrapolation:
2.Solution-practical code
a.Introduction about MATLAB
- MATLAB is a programming platform designed especially for engineers and
scientists to analyze and design the systems and products that transform our
world (analyze data, develop algorithms, create models and applications).
- The heart of MATLAB is the MATLAB language, a matrix-based language
allowing the most natural expression of computational mathematics.
8
The plot with X-axis from 1-12 which represent for twelve months in a year and
the Y-axis form 30-95 which represent for temperature.
Asum for now, we will use the temperatures of four months: January, May,
August and December. We select the data from variable WeatherHigh and generate to
Vandermonde matrix.
9
Next, we draw a graph shows the difference between the approximated values
and the exact values.
We will repeat the steps above but with the approximation with the higher degree
polynomial and draw a graph.
10
Figure 4: Approximation with the 5th degree polynomial
We can see that this approximation much closer results to the exact values. We
will continue to the steps above with 12 months and draw a graph.
11
Figure 5: Approximation with the 11th degree polynomial
Notice that this approximation is not better than the approximation with the 5th
degree polynomial (due to large fluctuation near the end points). The reason for this is
that Vandermonde matrix is an ill-conditioned matrix. If polynomials of a high degree
on evenly spaced grids are not good for interpolation, what can be done instead? The
most common method of interpolation is through the approximation of functions with
piece-wise (typically polynomial) functions.
Overall, we will use the least squares method to find the trend of the climate data
and then we can approximate the temperature in the future years. First of all, we will
load the matrix by using the load command.
12
Secondly, we continue to separate the data into 2 variables and display the result.
13
Then, using the plot command to procedure a graph of fluctuations of average
temperatures since 1880.
Now, we will extrapolate the data in the future. Assume that we want to know the
temperature about 10 years in the future and draw a graph to illustrates.
14
Figure 8: temperature in 10 years later.
Notice that: we can see that these approximations give us the difference answers
and this is not the correct answer because we haven’t got the tendencies. The local
fluctuations in temperature significantly affected the global predictions for the future.
However, we are not interested in the local fluctuations but rather in global tendencies.
So let us try to separate those two from each other and extrapolate based on global
tendencies only. We will use orthogonal projections to separate the global behavior
from the “noise”.And we calculate the average temperature of the data
15
In the 11 and 12 task we construct the simplest form of least square method by
using orthogonal projections on vector 1, then we can find c to minimize the norm
1
𝑝𝑟𝑜𝑗1 (𝑡 ) = ( 2 11𝑇 ) 𝑡 = 𝑃𝑡
||1||
16
Figure 9: Approximation of data by the constant function.
Notice that: the value of temp1is the same to the value of average temperature.
When we use the approximation of data by the constant function the value of this
function is always the average value of this data.
While the previous approach of approximating the data with a constant function
may be acceptable in some cases, it is clearly not a perfect match. Let us try instead to
model the data as a linear function of temperature (with no noise).
𝑡𝑖 = 𝑏𝑦𝑒𝑎𝑟𝑠𝑖 + 𝑐
17
Given an orthonormal basis defined by the columns of Q2 for the subspace S, the
formula for the projection matrix onto the subspace S is simple and temp2=P2*temp:
𝑃2 = 𝑄2 𝑄2𝑇
Now, let us make predictions for the future. Create a new cell and run the
following code:
20
V.Conclusion
By applying some acknowledgment that has been already taught in our course,
we can understand the concept of using the interpolation and extrapolation in
approximating the data as we have done in this topic.
VI.References
[1].Anna Zemlyanova.Applied projects for an introductory linear algebra class
[2]. N. J. H. Desmond J. Higham, Matlab Guide, 2016
[3]. R. Pratap, Getting Started with MATLAB 7: A Quick Introduction for Scientists
and
Engineers, Oxford University Press, 2005.
21
22