MATLAB2
pdf
keyboard_arrow_up
School
University of California, San Diego *
*We aren’t endorsed by this school
Course
18
Subject
Mathematics
Date
Apr 3, 2024
Type
Pages
9
Uploaded by SargentMask12558
Exercise 2.1 Convert this system of equations into a matrix equation of the form
Cx
=
d Enter the matrix
C
and the column vector
d
into MATLAB
C = [2 1 6; 1 0 3; -3 2 -7] C = 2 1 6 1 0 3 -3 2 -7 d = [1; 2; 3] d = 1 2 3 x = C\d x = -20.5000 -3.0000 7.5000 C*x-d
should be zero
C*x-d ans = 0 0 0
Exercise 2.2 Enter the corresponding matrix
C
and column vector
d
into MATLAB.
C = [-10 5; 6 -3] C = -10 5 6 -3 d=[0;0] d = 0 0 x = C\d Warning: Matrix is singular to working precision. x = NaN NaN How many free variables do you have in your solution? Based on your answer, can you explain why you got the error message when trying to use the command
x = C\d
?
1 free variable
if we simplify we get 2x1 = x2 so we have infinitely many solutions exist for these equations.
Exercise 2.3 By using the
rref
command, write down the general solution to this system of equations.
C = [1 -3 2; -2 6 -4; 4 -12 8] C = 1 -3 2 -2 6 -4 4 -12 8 d=[0;0;0] d = 0 0 0 rref([C d]) ans = 1 -3 2 0 0 0 0 0 0 0 0 0 How many free variables are required?
2 free variables are required
x1=3x2-2x3
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Exercise 2.4 The columns in this table all add up to 1. Explain why.
Because of the two basic assumptions •
Everyone exclusively buys from and sells to the central pool (i.e., there is no outside supply or demand). •
Everything produced is consumed. they all add up to 100%.
Exercise 2.5 Explain where this system of equations came from and what it means. (What do the left-hand side and the right-hand side of each equation represent?)
Left side represents expense. Right hand side represents total income.
Exercise 2.6 Enter the matrices
C
and
I
into MATLAB.
>> C = [0.25 0.15 0.25 0.18 0.20; 0.17 0.28 0.18 0.17 0.10; 0.22 0.19 0.22 0.22 0.10; 0.20 0.15 0.20 0.28 0.15; 0.16 0.23 0.15 0.15 0.45] C = 0.2500 0.1500 0.2500 0.1800 0.2000 0.1700 0.2800 0.1800 0.1700 0.1000 0.2200 0.1900 0.2200 0.2200 0.1000 0.2000 0.1500 0.2000 0.2800 0.1500 0.1600 0.2300 0.1500 0.1500 0.4500 >> I = eye(5) I = 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 The command
eye(n)
used here creates an n×n matrix with ones on the diagonal and zeros elsewhere.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
>> d=[0;0;0;0;0] d = 0 0 0 0 0 >> rref([C-I d]) ans = 1.0000 0 0 0 -0.8729 0 0 1.0000 0 0 -0.7355 0 0 0 1.0000 0 -0.7855 0 0 0 0 1.0000 -0.8222 0 0 0 0 0 0 0 highest- priced commodities in this model community is Moonshine because it is free variable.
lowest-priced commodities in this model community is clothes because it is 0.7355 which is lowest in all of them.
List the inhabitants in order of income, from lowest to highest. Tailor<Carpenter<Miner<Farmer<Bob If Bob makes $40,000 per year, the farmer makes $
34,916, the tailor makes $29,420, the carpenter makes $31,420, and the miner makes $32,888.
Exercise 2.7 a.) Create a linking matrix
L
containing the information of which site links to which, just as we did in the popularity example. Remember to normalize, and be sure that your input is exact.
>> L=[0 1/2 1/4 1 1/3; 1/3 0 1/4 0 0; 1/3 1/2 0 0 1/3; 1/3 0 1/4 0 1/3; 0 0 1/4 0 0;] L = 0 0.5000 0.2500 1.0000 0.3333 0.3333 0 0.2500 0 0 0.3333 0.5000 0 0 0.3333 0.3333 0 0.2500 0 0.3333 0 0 0.2500 0 0 >> b=[0;0;0;0;0;] b = 0 0 0 0 0
b.) Use the
rref
command to find all solutions
x
to the matrix equation (
L
-
I
)
x
=
0
. Include all input and output from MATLAB.
>> rref([L-I b]) ans = 1.0000 0 0 0 -6.3333 0 0 1.0000 0 0 -3.1111 0 0 0 1.0000 0 -4.0000 0 0 0 0 1.0000 -3.4444 0 0
0 0 0 0 0 c.) Which website has the highest PageRank? Explain your answer, especially in light of any negative numbers that may have appeared in your solutions. List the remaining websites in decreasing PageRank order. Website A has the highest PageRank because base on free variable E website A is 6.3333 which is the highest in all of them. The
remaining websites in decreasing PageRank order is A, C, D, B, E
Because 6.3333>4.0000>3.4444>3.1111>0
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help