Filter löschen
Filter löschen

Are there any matrix balancing/scaling function in matab for complex rectagular matrices?

15 Ansichten (letzte 30 Tage)
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.

Antworten (3)

Bruno Luong
Bruno Luong am 22 Feb. 2023
Check out normalize
  1 Kommentar
Bruno Luong
Bruno Luong am 22 Feb. 2023
Bearbeitet: Bruno Luong am 22 Feb. 2023
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)
ans =
1.666924175460802e+14
cond(B)
ans =
2.778622490159825
x = (B\y)./s(:) % should be more robust than the following
x =
0.000000000000002 - 0.000000000000002i 0.244040987459613 - 0.184030202199825i
x = A\y
Warning: Rank deficient, rank = 1, tol = 1.825553e+02.
x =
1.0e-14 * 0.409132990480610 - 0.367001236504611i 0.000000000000000 + 0.000000000000000i

Melden Sie sich an, um zu kommentieren.


Steven Lord
Steven Lord am 22 Feb. 2023
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
x2 = 2×1
2 3

William Rose
William Rose am 22 Feb. 2023
Bearbeitet: William Rose am 22 Feb. 2023
[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
ans =
1.0000 - 0.0000i 0.0000 - 0.0000i -0.0000 + 0.0000i 1.0000 + 0.0000i
Try it.

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by