Are there any matrix balancing/scaling function in matab for complex rectagular matrices?
조회 수: 7 (최근 30일)
이전 댓글 표시
I have a complex number matrix with 45 x 2 size. And it needs to be inverted. But the condition number is too large around 8000. So I need to perform matrix balancing to improve the condition number. Is there any function in matlab to perform this operation? I found functions like 'balance', but works only for square matrices.
댓글 수: 0
답변 (3개)
Bruno Luong
2023년 2월 22일
Check out normalize
댓글 수: 1
Bruno Luong
2023년 2월 22일
편집: Bruno Luong
2023년 2월 22일
Here is how to use it
format long
% Generate some unbalance matrix
A=(rand([100,2])+1i*rand([100,2])).*[1e14 1];
y=rand(size(A,1),1);
[An,c,s]=normalize(A);
B = (An+c./s);
cond(A)
cond(B)
x = (B\y)./s(:) % should be more robust than the following
x = A\y
Steven Lord
2023년 2월 22일
I have a complex number matrix with 45 x 2 size. And it needs to be inverted.
How exactly do you define inversion for a non-square matrix? The standard definition of matrix inverse requires that the matrix be square. There are definitions for generalized inverses; which one are you trying to use?
Or are you trying to solve a system of 45 equations in 2 unknowns? In that case, don't try to invert the matrix. Use the backslash operator instead. As an example with a smaller random coefficient matrix and a known solution of [2; 3]:
rng default % for reproducibility
A = randi([-10 10], 6, 2);
x = [2; 3];
b = A*x;
x2 = A\b % This should be the same as x
댓글 수: 0
William Rose
2023년 2월 22일
편집: William Rose
2023년 2월 22일
[edit : correct spelling]
You say you want to invert a 45x2 matrix. As you know, a non-square matrix does not have an inverse. But is does have a pseudoinverse. Let us compute G, using the data and the formula from your posting elsewhere:
load g1.mat
load t.mat
G = [g1 -g1.*t];
This particular G is complex, since the data you provided before was complex. Now compute the pseudo inverse:
pinvG=pinv(G);
Confirm that pinvG*G is approximately the identity matrix:
pinv(G)*G
Try it.
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!