%
% Symbolic code for DFIM delta connection
%
syms lss lsw msw lrr lrw mrw lsr msr np th ...
     lssdy lsrdy aux checkzero lsrdd real
%
% Original model
%
a=2*pi/3;
lss=[lsw msw msw;msw lsw msw;msw msw lsw];
lrr=[lrw mrw mrw;mrw lrw mrw;mrw mrw lrw];
lsr=msr*[cos(np*th) cos(np*th+a) cos(np*th-a); ...
    cos(np*th-a) cos(np*th) cos(np*th+a);
    cos(np*th+a) cos(np*th-a) cos(np*th)];
%
% lsr for delta-Y conversion
%
md=[1/3 -1/3 0;0 1/3 -1/3;-1/3 0 1/3];
lssdy=simplify(md'*lss*md)
lsrdy=simplify(md'*lsr)
aux=(msr/sqrt(3))*[cos(np*th-pi/6) cos(np*th+pi/2) cos(np*th-5*pi/6);
    cos(np*th-5*pi/6) cos(np*th-pi/6) cos(np*th+pi/2);
    cos(np*th+pi/2) cos(np*th-5*pi/6) cos(np*th-pi/6)];
checkzero=simplify(lsrdy-aux)
% 
% lsr for delta-delta conversion
%
lsrdd=simplify(md'*lsr*md)
checkzero=simplify(lsrdd-lsr/3)