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

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

Réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by