Finding the eigenvalues with an augmented matrix 2x2
3 次查看(过去 30 天)
显示 更早的评论
Hi, I somehow have a problem with obtaining the row reduction in an augumented matrix to find lamda. Currently I have this code:
% A
I = eye(2)
m1 = [7 3; 3 -1]
Lamda = 8 % The value for λ
% B
LaI = I * Lamda % Identity matrix - value of λ
m2s = m1 - LaI % Caluculating the new matrix
% C
zc = zeros(size(m2s,1),1) % creating a zero column
m3s = [m2s, zc] % adding the zero column at the end
% D
A3 = [-1 3;
3 -9]
b = [0; 0]
[L, U, P] = lu(A3) % L = all multipliers, U = upper triangular matrix, P = row interchanges
% factors to solve linear system
y = L\(P*b) % Forward substitution
x = U\y %Backward substitution
In part D there I get this warning:
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 5.551115e-17. <warning </warning>
I got 2 question:
First, how do I fix it?
Second how can I define the relationship between x1 and x2?
Help is much appreciated <3 Thanks!
1 个评论
David Goodmanson
2022-5-3
编辑:David Goodmanson
2022-5-3
Hi Jonas,
in %D, the matrix A3 is singular. So solving the Ax = b problem by LU decomposition or any other method is not going to work.
A3 is the same as m2s, which you obtained from m1 - 8*I, where 8 is one of the eigenvalues of m1. Therefore m2s is singular by construction. It looks like you need to go bakc and reassess the entire process.
回答(1 个)
Dinesh
2023-9-20
Hi Jonas,
I understand you are trying to find the 'x' from system of equations A3x = b. The A3 that you specified is an singular matrix. So the inverse for the Matrix A3 does not exist. To solve this you can use 'pinv' function in MATLAB to find pseudo inverse.
'pinv' calculates 'Moore-Penrose pseudo inverse' matrix which can act as a partial replacement for the matrix inverse in cases where it does not exist. This matrix is frequently used to solve a system of linear equations when the system does not have a unique solution or has many solutions.
A3 = [-1 3;
3 -9];
b = [0; 0];
x = pinv(A3) * b
You can also use 'lsqminnorm' function to do the following task. lsqminnorm(A,B) returns an array X that solves the linear equation AX = B and minimizes the value of norm(A*X-B). If several solutions exist to this problem, then lsqminnorm returns the solution that minimizes norm(X)
lsqminnorm(A3,b)
For more details regarding the 'pinv' and 'lsqminnorm' functions please refer the following MATLAB documentation
- https://www.mathworks.com/help/matlab/ref/pinv.html
- https://www.mathworks.com/help/matlab/ref/lsqminnorm.html
Hope this helps.
Best regards,
Dinesh Reddy Gatla.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!