Question

In: Advanced Math

Using Matlab, write code that carries out the following instructions: **Within your Live Script, create a...

Using Matlab, write code that carries out the following instructions:

**Within your Live Script, create a matrix A by starting with eye(5) and performing the following sequence of elementary row-operations: first, replace (row4) with [(row4) + (row2) ⋅3], then, interchange rows 1 and 3 of the obtained matrix, and, finally, scale row5 of the matrix from the previous step by 6 to get the output matrix A. Display A.

Note: To complete this part, you, should, first, create (and output) the required elementary matrices for the corresponding sets of variables (the variables are specific for each function!) and use consecutive three step left-multiplication to get the matrix A.

% Explain in your Live Script a reason why the obtained matrix A is invertible.

**Calculate (and output) the inverse of A, by using the MATLAB command inv1=inv(A)

**Then, calculate and output the matrix inv2 which is the inverse of A obtained by multiplying (in the reverse order!) the inverses of the elementary matrices whose product is A. (You can apply a MATLAB command inv() to the matrices E1, E2, E3.)

**Run a conditional statement in the Live Scrip that would check if the matrices inv1 and inv2 match. If yes, output a message that the inverses match; otherwise, output the message: “Check the coding!” (This message, if received, should prompt you to make corrections and re-run the Section.)

Solutions

Expert Solution

ANSWER:

Given That data Within your Live Script, create a matrix A by starting with eye(5) and performing the following sequence of elementary row-operations: first, replace (row4) with [(row4) + (row2) ⋅3], then, interchange rows 1 and 3 of the obtained matrix, and, finally, scale row5 of the matrix from the previous step by 6 to get the output matrix A. Display A.

Note: To complete this part, you, should, first, create (and output) the required elementary matrices for the corresponding sets of variables (the variables are specific for each function!) and use consecutive three step left-multiplication to get the matrix A.

% Explain in your Live Script a reason why the obtained matrix A is invertible.

**Calculate (and output) the inverse of A, by using the MATLAB command inv1=inv(A).

So

Mat lab code:

% Creating Matrix A

A = eye(5)

% Matrix E1

E1 = eye(5);

E1(4, 2) = 1

% Matrix E2

E2 = eye(5);

E2(1, 1) = E2(3, 3) = 0;

E2(1, 3) = E2(3, 1) = 1

% Matrix E3

E3 = eye(5);

E3(5, 5) = 6

% Matrix A

A = E1 * A

A = E2 * A

A = E3 * A

% inv1

inv1 = inv(A)

% inv2

inv2 = inv(E3) * inv(E2) * inv(E1)

% Checking for equality

if inv1 == inv2

    disp("Matrices Match")

else

    disp("Check Coding")

end;

OUTPUT:

A=

Diagonal Matrix

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

E1 =

1 0 0 0 0

0 1 0 0 0

0 0 1 0 0

0 1  0 1 0

0 0 0 0 1

E2=

0 0 1 0 0

0 1 0 0 0

1 0 0 0 0

0 0 0 1 0

0 0 0 0 1

E3=

Diagonal Matrix

1 0 0 0 0

0 1 0 0 0

0 0 1 0 0

0 0 0 1 0

0 0 0 0 6


Related Solutions

Using MATLAB or Octave, use documenting code to Write a script that prompts the user for...
Using MATLAB or Octave, use documenting code to Write a script that prompts the user for a minimum and maximum real number, then generates and prints a random number in the requested range. The script should then do the same for an integer range. Sample output: Enter a minimum real value: 0.5 Enter a maximum real value: 30 A random number in the range ( 0.5000, 30.0000 ) is 1.7851 Enter a minimum integer value: -10 Enter a maximum integer...
Write a R-script to (and show the outputs of your code) (a) Create a sequence of...
Write a R-script to (and show the outputs of your code) (a) Create a sequence of numbers starting at 3.5 and ending at 10.7 with increments of 0.79. Find the variance and mean of those numbers. And finally sort the vector in a decreasing manner (b) Create a 3 different 3 by 3 matrices such that each of the numbers 1,2,...,9 appear exactly once (Sudoku style) in each of the matrices.
Matlab code problems I have to write a code using functions to find out if a...
Matlab code problems I have to write a code using functions to find out if a year is a leap year. I'm on the write track i feel like but I keep getting an error message and matlab isnt helping to troubleshoot. The issue is on line 30. Here is my code: function project_7_mfp() %   PROJECT_7_ABC   project_7_abc() creates a function that prompts the user %   enter a year after 1582 It then determines if it is a leap year %...
(MATLAB) Write a script that would create a 3x5 matrix of random integers and write this...
(MATLAB) Write a script that would create a 3x5 matrix of random integers and write this new matrix to a file called “Assignment3_Question5.dat”.
MATLAB is program Respond fast please a quiz Create a MATLAB script. Using nested for loops,...
MATLAB is program Respond fast please a quiz Create a MATLAB script. Using nested for loops, evaluate the multivariable function: z = sin ⁡ ( x ) cos ⁡ ( y ) for x between -4 and 4 in steps of 1 y between -2 and 2 in steps of 1 Display the matrix z Cut and paste the following into a word doc and submit to this question. Your script code Your input Your output
Instructions: 1. Solve the following problems in a MATLAB script. You will be allowed to submit...
Instructions: 1. Solve the following problems in a MATLAB script. You will be allowed to submit only one script, please work all the problems in the same script (Hint: careful with variables names) 2. Show your work and make comments in the same script (Use %). Please write your name in the first line of the scrip with % 3. It is OK to work with other students, but what you submit should be your own work – not something...
Instructions: 1. Solve the following problems in a MATLAB script. You will be allowed to submit...
Instructions: 1. Solve the following problems in a MATLAB script. You will be allowed to submit only one script, please work all the problems in the same script (Hint: careful with variables names) 2. Show your work and make comments in the same script (Use %). Please write your name in the first line of the scrip with % 3. It is OK to work with other students, but what you submit should be your own work – not something...
Using MATLAB or Octave, Write a script that prompts the user for the coordinates of three...
Using MATLAB or Octave, Write a script that prompts the user for the coordinates of three points A, B, and C, namely (xA, yA), (xB, yB), (xC, yC), forming a triangle, storing each in a variable (for a total of 6 variables). The script should then calculate the centroid G = (xG, yG) using xG = xA+xB+xC 3 and yG = yA+yB+yC 3 , storing each in a variable. Finally, the script should print all four points. Sample output: Enter...
Using MATLAB or Octave, Write a script that prompts the user for a multiplier, storing it...
Using MATLAB or Octave, Write a script that prompts the user for a multiplier, storing it in the variable fMultiplier. The script should them prompt the user for a number, storing it in the variabl fIn. The script should then calculate the product of these two variables, saving the result to another variable fOut, and printing it. The script should then repeat the prompt for fIn, calculation, and output twice more, using the same variable fIn and fOut all three...
Using MATLAB or Octave, Write a script that prompts the user for a minimum and maximum...
Using MATLAB or Octave, Write a script that prompts the user for a minimum and maximum real number, then generates and prints a random number in the requested range. The script should then do the same for an integer range. Sample output: Enter a minimum real value: 0.5 Enter a maximum real value: 30 A random number in the range ( 0.5000, 30.0000 ) is 1.7851 Enter a minimum integer value: -10 Enter a maximum integer value: 20 A random...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT