Clear Filters
Clear Filters

inversing huge Y Matrix

26 views (last 30 days)
Matthew Worker
Matthew Worker on 10 May 2024
Edited: Rena Berman on 20 May 2024
Hello, I need to get Zbus for some short circuit study. The system is huge consisting of over 9000 buses. From psse, I found the ybus which is quite sparse and inversing it is giving me wrong results. Could anyone please tell me how to inverse such huge matrix to get zbus?
  1 Comment
Steven Lord
Steven Lord on 10 May 2024
How exactly are Zbus and ybus related? [From your description is sounds like those are commonly used terms/variable names in your area of study, but please explain the relationship for those of us who aren't familiar with that area.]
How are you storing ybus? Is it a full matrix that has only a few non-zero elements (sparsely populated but not sparsely stored) or is it a sparse matrix (sparsely populated and sparsely stored)?
fullWithOnlyFewNonzero = eye(5)
fullWithOnlyFewNonzero = 5x5
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
sparseWithOnlyFewNonzeros = speye(5)
sparseWithOnlyFewNonzeros =
(1,1) 1 (2,2) 1 (3,3) 1 (4,4) 1 (5,5) 1
whos full* sparse*
Name Size Bytes Class Attributes fullWithOnlyFewNonzero 5x5 200 double sparseWithOnlyFewNonzeros 5x5 128 double sparse
Generally speaking, as John D'Errico said unless you absolutely positively explicitly need an inverse matrix you should not invert the matrix but should try an alternate approach. For example, if you're trying to solve a system of equations use the backslash operator \. [Yes, when you did this type of exercise in class while you were learning, you may have been told to invert. That's one of the cases where there's a difference between theory and practice.]

Sign in to comment.

Answers (1)

John D'Errico
John D'Errico on 10 May 2024
Edited: John D'Errico on 10 May 2024
As always, I'll start by saying that computing the inverse of a matrix is a bad idea. And of course, you don't say what you think is "wrong", nor do you provide the matrix. (Just attach it to a comment in the form of a .mat file. Since it is sparse as you claim, it won't take much space anyway to store.)
First, you need to understand if the matrix is of full rank. If not, then you cannot find the "right" result, as there are infinitely many solutions, if you would find any solutions at all.
You also need to learn about things like condition numbers. But without seeing the matrix itself, this answer would then turn into a full course on numerical linear algebra. And, while you would surely benefit from that since you are trying to compute the inverse of a matrix, Answers is not the place to teach it. So post the matrix in a .mat file, attached to a comment, and we can see if we can help you more.
Sam Chak
Sam Chak on 12 May 2024
Edited: Rena Berman on 20 May 2024
According to the Nodal Admittance Matrix on Wikipedia, for a three-bus network, the bus admittance matrix (Ybus) can be constructed as described. The bus impedance matrix (Zbus) can then be obtained by taking the inverse of Ybus. Is that what you have been doing for a sparse matrix Ybus?
%% admittances
y1 = -5i;
y12 = -1.25i;
y13 = -2.5i;
y2 = -2.5i;
y23 = -2.5i;
y3 = 0i;
%% Bus admittance matrix
Y11 = y1 + y12 + y13;
Y12 = -y12;
Y13 = -y13;
Y22 = y2 + y12 + y23;
Y23 = -y23;
Y33 = y3 + y13 + y23;
Ybus= [Y11, Y12, Y13;
Y12, Y22, Y23;
Y13, Y23, Y33]
Ybus =
0.0000 - 8.7500i 0.0000 + 1.2500i 0.0000 + 2.5000i 0.0000 + 1.2500i 0.0000 - 6.2500i 0.0000 + 2.5000i 0.0000 + 2.5000i 0.0000 + 2.5000i 0.0000 - 5.0000i
%% Bus impedance matrix
Zbus= inv(Ybus)
Zbus =
0.0000 + 0.1600i 0.0000 + 0.0800i 0.0000 + 0.1200i 0.0000 + 0.0800i 0.0000 + 0.2400i 0.0000 + 0.1600i 0.0000 + 0.1200i 0.0000 + 0.1600i 0.0000 + 0.3400i
Paul on 12 May 2024
Hi Sam,
Obviously, I can't say for sure, but I think that's the idea. In this comment I posted the equation for the Thevenin Impedance Distance between nodes. I played around for a little bit, and it wasn't clear to me how to compute the distance matrix from Ybus without first explicitly computing Zbus.

Sign in to comment.


Find more on MATLAB Mobile Fundamentals in Help Center and File Exchange


Community Treasure Hunt

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

Start Hunting!