Mini Project Linear Algebra II
Mini Project Linear Algebra II
Mini Project Linear Algebra II
Prepared by:
Prepared for:
INTRODUCTION 2
IMPLEMENTATION 3 - 10
● Linear Model 3-5
● Quadratic Model 6-7
● Cubic Model 8 -10
GRAPHS 10 - 12
● Graph Best Fit Curve Against Its Observed Data 10 - 11
● Graph of The Error Vector Against x Values 11 - 12
APPENDIX 14 - 29
● Commands and Output For Linear Model 14 - 18
● Commands and Output For Quadratic Model 19 - 23
● Commands and Output For Cubic Model 24 - 29
REFERENCES 30
1
INTRODUCTION
A shopping mall is a specially built covered area containing shops and restaurants which
people can walk between, and where cars are not allowed.The following data is the annual
incomes of customers and the spending scores of customers while being in the shopping mall.
X represents the customers' annual income (k$) and Y represents the spending scores
(1-100) of customers in the shopping mall.
X 15 15 16 16 17 17 18 18 19 19 19 19 20 20 20 20 21 21 23 23
Y 39 81 6 77 40 76 6 94 3 72 14 99 15 77 13 79 35 66 29 98
2
IMPLEMENTATION
Linear model : 𝑦 = 𝑎 + 𝑏𝑥
The data generates a system of linear equations with the matrix representation as below:
3
The best fit line curve is
||e|| = 48.02131783
4
2
Quadratic Model : 𝑦 = 𝑎 + 𝑏𝑥 + 𝑐𝑥
5
The best fit quadratic curve is
||e|| = 52.0809279
6
2 3
Cubic Model : 𝑦 = 𝑎 + 𝑏𝑥 + 𝑐𝑥 + 𝑑𝑥
The matrix representation of the above system is
7
The least square solution is
8
||e|| = 51.96428174
9
GRAPHS
Graph Best Fit Curve Against Its Observed Data
Linear Model
Quadratic Model
10
Cubic Model
Linear Model
11
Quadratic Model
Cubic Model
12
ANALYSIS AND CONCLUSION
Based on the three models above, the following error magnitudes in the approximation are
obtained:
Thus, the best fit curve in this case which will give the best approximation is the linear best fit
curve because it has the minimum error in terms of its magnitude.
13
APPENDIX
Commands and Output For Linear Model
14
15
16
17
18
Commands and Output for Quadratic Model
19
20
21
22
23
Commands and Output for Cubic Model
24
25
26
27
28
29
REFERENCES :
Internet Sources
30