Are there any matrix balancing/scaling function in matab for complex rectagular matrices?
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (3)
Bruno Luong
am 22 Feb. 2023
Check out normalize
1 Kommentar
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)
cond(B)
x = (B\y)./s(:) % should be more robust than the following
x = A\y
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
0 Kommentare
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
Try it.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Linear Algebra 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!