Lab4 LU Factorization
Lab4 LU Factorization
Lab 4. LU Factorization
Name:
1 Instructions
• Make a pdf report including the solution to each point of the practice with name
Lab4 name lastname.pdf.
• Send the report and all created files in a zip file with name Lab4 name lastname.zip in the
Moodle.
• You are allowed to use internet, notes, and .m files that you have created before.
• It is PROHIBITED to use Large Language Models (LLMs) or share the code with classmates.
2 Purposes
• To understand the LU Factorization method.
• To implement the LU Factorization method in Matlab.
• To interpret the LU Factorization method.
3 Practice
3.1 Understanding
Answer with your own words the following questions:
• (0.2 points) What is LU factorization?
1
3.2 Implementing
• (0.8 point) Create a Matlab function called my lu name lastname() to find the LU factoriza-
tion of a matrix. The arguments of the function must be: the matrix. For instance,
[ L,U ] =my lu name lastname(A);
• (0.2 points) Make a script named main name lastname.m, in there find the triangular fac-
torization A = LU for the following matrix by using the created LU function
1 1 0 4
2 −1 5 0
A= 5
(1)
2 1 2
−3 0 2 5
• (0.4 points) Use the created LU function to solve the system Ax = b in the script
main name lastname.m, where
1 2 −3 4 3
4 8 12 −8
, and b = 60 .
A= 2 3 2 (2)
1 1
−6 2 1 −8 5
• (0.2 points) Compare the results with the LU decomposition obtained by the MATLAB com-
mand lu()in the script main name lastname.m. Discuss what you observe.
3.3 Interpreting
Sophia sells pictures of the Eiffel Tower. She prices the pictures according to size: miniature pictures
cost $10, normal-size pictures cost $15, and huge pictures cost $40. She usually sells as many
miniature pictures as normal-sized and huge pictures combined. She also sells twice as many normal-
size pictures as huge ones. The fixed cost of her pictures is $250. How many of each size must she
sell to cover the fixed cost?
3.4 Analyzing
(0.8 points) Use PALU factorization to solve a linear regression problem with missing values and
outliers in a real estate data set in the script main name lastname.m. PALU factorization helps to
obtain robust estimates of the regression coefficients. The system to be solved is as follows:
2 −1
3
−1
2 −2 4
A= and b = −2 . (3)
1
−1 −1 0
2
3.5 Proposing
• (0.8 points) Propose an application problem in which the PALU factorization can be used. The
problem should include at least 3 variables and be solved in the script main name lastname.m.