Are there any matrix balancing/scaling function in matab for complex rectagular matrices?
6 次查看(过去 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!