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z43*((Z(3,2)-Z(3,3))-(Z(4,2)-Z(4,3)))/Zden1; L11=(L1423+L1434*L3423)/(1-L2334*L3423); L12=(L1434+L1423*L2334)/(1-L2334*L3423); I14d=I14+(L11*I23+L12*I34); mprintf("Change in current line connected buses 1-4 is %.4f+%.4f",real(I14d),imag(I14d));