Large Matrix Kron Reduction - How to transform below three nested loop to something faster

3 views (last 30 days)
I'm trying to use Kron Reduction to reduce size of Ybus matrix. As the size of Ybus matrix increases to 1000 or more, the code is almost useless as it takes too much time. Is there a way I can use Parfor? Any other suggestion how to reduce calculation time?
tic
num=9241;
Ybus_temp = YbusAugmentation(num); %A function which modifies original Ybus matrix
L = num:-1:1;
for s=L
m = length(Ybus_temp);
for i=1:m
for k = 1:m
if i~=s && k~=s
Ybus_temp(i,k) = Ybus_temp(i,k) - ((Ybus_temp(i,s)*Ybus_temp(s,k))/Ybus_temp(s,s));
end
end
end
Ybus_temp(s,:)=[];
Ybus_temp(:,s)=[];
end
Ybus_reduced=Ybus_temp;
toc

Answers (0)

Categories

Find more on Loops and Conditional Statements 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!