Слайд 5Метод контурних струмів у матричній формі
E1a = 25; E2a = 15;
R1 =
100; R2 = 100; R3 = 100;
R4 = 100; R5 = 100; R6 = 100;
R7 = 100;
t = 0:1/150/50:0.04;
E =[E2a * sin(2 * 3.14159 * 100 * t);
E1a * sin(2 * 3.14159 * 50 * t);
0.0 * sin(2 * 3.14159 * 150 * t);];
R = [R1+R6+R4 -R6 0 ;
-R6 R6+R2+R7 R7 ;
0 R7 R3+R5+R7];
I = R\E;
figure(1);
plot(t,E(1,:),t,E(2,:)), grid, set(gca,'FontName','Arial Cyr','FontSize',16),
title(' Electromotive forces in the circuits'); xlabel('Time (sec)'); ylabel('E(t)')
figure(2);
plot(t,I(1,:),t,I(2,:),t,I(3,:)), grid, set(gca,'FontName','Arial Cyr','FontSize',16),
title('Contour currents'); xlabel('Time (sec)'); ylabel('E(t)')
i1 = I(1,:);
i6 = I(1,:)-I(2,:);
i2 = I(2,:);
figure(3);
plot(t,i1,t,i6,t,i2), grid, set(gca,'FontName','Arial Cyr','FontSize',16),
title('Currents in the branches'); xlabel('Time (sec)'); ylabel('E(t)')
% Verification of Kirchhoff's 1st Law
Zero = 0.0;
N = size(i1);
for i=1:N(2)
Zero = [Zero; i1(i)-i6(i)-i2(i)];
end
Zero(1) = [];
figure(4);
plot(t,Zero), grid, set(gca,'FontName','Arial Cyr','FontSize',16),
title(' Verification of Kirchhoffs 1st Law'); xlabel('Time (sec)'); ylabel('E(t)')