MATLAB Script (run it as a script, NOT from command window):
close all
clear
clc
A = magic(8);
% Question 3
N = null(A);
disp('Basis for Nul A ='), disp(N)
C = colspace(sym(A));
disp('Basis for Col A ='), disp(C)
% Question 4
R = colspace(sym(A'));
disp('Basis for Row A ='), disp(R)
% Question 5
D = magic(9)
is_invertible(D);
E = magic(10)
is_invertible(E);
function [] = is_invertible(A)
if isequal(rank(A), min(size(A)))
disp('Input matrix is invertible.')
else
disp('Input matrix is not invertible.')
end
end
Output:
Basis for Nul A =
0.4461 -0.0045 0.1630 -0.1376 0.4624
0.0316 -0.5347 0.0588 0.2851 0.4791
0.1563 0.5031 0.6123 -0.1575 -0.1384
-0.8174 0.0572 0.2353 0.0846 0.1006
0.2530 -0.3858 0.1346 0.2465 -0.6726
-0.1707 -0.2984 -0.2570 -0.6808 -0.2206
-0.0172 0.3300 -0.4141 0.5532 -0.1201
0.1182 0.3330 -0.5329 -0.1935 0.1096
Basis for Col A =
[ 1, 0, 0]
[ 0, 1, 0]
[ 0, 0, 1]
[ 1, 3, -3]
[ 1, 4, -4]
[ 0, -3, 4]
[ 0, -4, 5]
[ 1, 7, -7]
Basis for Row A =
[ 1, 0, 0]
[ 0, 1, 0]
[ 0, 0, 1]
[ 1, 3, -3]
[ 1, 4, -4]
[ 0, -3, 4]
[ 0, -4, 5]
[ 1, 7, -7]
D =
47 58 69 80 1 12 23 34 45
57 68 79 9 11 22 33 44 46
67 78 8 10 21 32 43 54 56
77 7 18 20 31 42 53 55 66
6 17 19 30 41 52 63 65 76
16 27 29 40 51 62 64 75 5
26 28 39 50 61 72 74 4 15
36 38 49 60 71 73 3 14 25
37 48 59 70 81 2 13 24 35
Input matrix is invertible.
E =
92 99 1 8 15 67 74 51 58 40
98 80 7 14 16 73 55 57 64 41
4 81 88 20 22 54 56 63 70 47
85 87 19 21 3 60 62 69 71 28
86 93 25 2 9 61 68 75 52 34
17 24 76 83 90 42 49 26 33 65
23 5 82 89 91 48 30 32 39 66
79 6 13 95 97 29 31 38 45 72
10 12 94 96 78 35 37 44 46 53
11 18 100 77 84 36 43 50 27 59
Input matrix is not invertible.
solve problem 3 4 snd 5 Due April 17,2019 m IS weda Look over the commands...
1 Problem 7 Let A 4 5 - 1 5 0 2 -1 2 3 -4 7 2 1 3 7 2 -4 2 0 0 10 1 1 a) (4 pts] Using the [V, DJ command in MATLAB with rational format, find a diagonal matrix D and a matrix V of maximal rank satisfying the matrix equation A * V = V * D. Is A real-diagonalizable? b) (4 pts) Write down the eigenvalues of A. For each eigenvalue,...
In this exercise you will work with LU factorization of an matrix A. Theory: Any matrix A can be reduced to an echelon form by using only row replacement and row interchanging operations. Row interchanging is almost always necessary for a computer realization because it reduces the round off errors in calculations - this strategy in computer calculation is called partial pivoting, which refers to selecting for a pivot the largest by absolute value entry in a column. The MATLAB...
4 7 5 0 2 2 Problem 7 Let A= -1 2 9 -4 1 5 -1 3 7 3 1 -4 2 0 1 1 0 10 2 a) (4 pts] Using the [V, D] command in MATLAB with rational format, find a diagonal matrix D and a matrix V of maximal rank satisfying the matrix equation A * V = V * D. Is A real-diagonalizable? b) [4 pts) Write down the eigenvalues of A. For each eigenvalue,...
Problem #2: Consider the following vectors, which you can copy and paste directly into Matlab. x=[3 4 4 3 5 5 1 2 32); y [2 4 4622 4 2 4] Use the vectors x and y to create the following matrix. 3 2 0 0 0 0 0 0 0 o Such a matrix is called a tri-diagonal matrix. Hint: Use the diag command three times, and then add the resulting matrices. To check that you have correctly created...
Problem #5: (a) Let u = (10, 4, -1, 8) and v = (-5, 10, -6, -1). Find ||u - proj,u||. Note: You can partially check your work by first calculating proj^u, and then verifying that the vectors projyu and u proj^u are orthogonal (b) Consider the following vectors u, v, w, and z (which you can copy and paste directly into Matlab). u -8.9 -9.8 -5.8], v = [0.8-4.1 -3.71, w = [8.6 -9.1 -8.11, [3.4 4.8 3.11 z...
Problem #5: (a) Let u =(2, -4,-8, -10) and v=(-1, -3, 8, -10). Find ||u – proj,u||. Note: You can partially check your work by first calculating projyu, and then verifying that the vectors projyu and u-proj,u are orthogonal. (b) Consider the following vectors u, v, w, and z (which you can copy and paste directly into Matlab). v = (-8.1 4.2 6.3], w = [-9 -3.7 5.5], u z = = [-8.6 -3.4 -7.1], [-3.2 2 -4.9] Find the...
MATLAB ONLY gauss.jpg BELOW Instructions: The following problems can be done interactively or by writing the commands iın an M-file (or by a combination of the two). In either case, record all MATLAB input commands and output in a text document and edit it according to the instructions of LAB 1 and LAB 2. For problem 2, include a picture of the rank-1 approximation. For problem 3, include a picture of the rank-10 approximation and for problem 4, include a...