%This script uses MATLAB's symbolic manipulator to recover %conductances for a Y network from its response matrix clear all %define conductances, K, L, and entries in L syms g14 g24 g34 K L a b c real %construct symbolic Kirchhoff matrix K K = sym(zeros(4,4)); K(1,4) = -g14; K(2,4) = -g24; K(3,4) = -g34; K = K + K'; for i = 1:4 K(i,i) = -sum(K(i,:)); end K %construct symbolic response matrix L L = sym(zeros(3,3)); L(1,2) = a; L(1,3) = b; L(2,3) = c; L = L + L'; for i = 1:3 L(i,i) = -sum(L(i,:)); end L %calculate a response matrix A from K syms A real A = sym(getL(K,3)); %now solve the three equations we get by comparing L and A %corresponds to entries above the main diagonal [g14 g24 g34] = solve(A(1,2)-L(1,2), A(1,3)-L(1,3), A(2,3)-L(2,3),g14,g24,g34) %now get the conductances for a specific L exampleK = sym([1 0 0 -1;0 2 0 -2;0 0 3 -3;-1 -2 -3 6]) exampleL = sym(getL(exampleK,3)); a = exampleL(1,2); b = exampleL(1,3); c = exampleL(2,3); g14 = subs(g14) g24 = subs(g24) g34 = subs(g34)