Code covered by the BSD License

# Kirchoff Method, Electrotechnics

### ISMAIL GULTEKIN (view profile)

Solving matrices in the Kirchoff(Circle Currents) Method.

ElectroTechnics_SolvingMatrices.m
```%% SOLVING MATRICES AT ELECTROTECHNICS
%Writer:  . Gkhan GLTEKN
%Company: Balkesir University

%%CIRCLE CURRENTS METHOD
% Equations:
disp(' ');
disp('1. Variables: 2');
disp('2. Variables: 3');
disp(' ');
A = input('Equation type selection: 1 or 2 ? ');
disp(' ');

switch A
case 1

disp('Format: a1*I1 + b1*I2 = X');
disp('        a2*I1 + b2*I2 = Y');
disp(' ');

%Entering datas:
a1 = input('Variable a1: ');
b1 = input('Variable b1: ');
X =  input('Variable X: ' );
a2 = input('Variable a2: ');
b2 = input('Variable b2: ');
Y =  input('Variable Y: ' );

disp(' ');
delta = [a1 b1 ; a2 b2];
delta1 = [X b1 ; Y b2];
delta2 = [a1 X ; a2 Y];
disp(' ');
I1M = delta1 / delta;
I2M = delta2 / delta;
I1 = det(I1M);
I2 = det(I2M);
disp(' ');

disp(['Current 1: ',num2str(I1) ' A']);
disp(['Current 2: ',num2str(I2) ' A']);

case 2

disp('Format: a1*I1 + b1*I2 + c1*I3 = X');
disp('        a2*I1 + b2*I2 + c2*I3 = Y');
disp('        a3*I1 + b3*I2 + c3*I3 = Z');
disp(' ');
%Entering datas
a1 = input('Variable a1: ');
b1 = input('Variable b1: ');
c1 = input('Variable c1: ' );
X  = input('Variable X : ');
a2 = input('Variable a2: ');
b2 = input('Variable b2: ' );
c2 = input('Variable c2: ');
Y  = input('Variable Y : ' );
a3 = input('Variable a3: ');
b3 = input('Variable b3: ');
c3 = input('Variable c3: ' );
Z  = input('Variable Z : ');

delta = [a1 b1 c1 ; a2 b2 c2 ; a3 b3 c3];
delta1 = [X b1 c1 ; Y b2 c2 ; Z b3 c3];
delta2 = [a1 X c1 ; a2 Y c2 ; a3 Z c3];
delta3 = [a1 b1 X ; a2 b2 Y ; a3 b3 Z];

I1M = delta1 / delta;
I2M = delta2 / delta;
I3M = delta3 / delta;

I1 = det(I1M);
I2 = det(I2M);
I3 = det(I3M);
disp(' ');

disp(['Current 1: ',num2str(I1) 'A']);
disp(['Current 2: ',num2str(I2) 'A']);
disp(['Current 3: ',num2str(I3) 'A']);

end
```