% esercizio 1.9 Luongo Paolone

syms ep11 ep22 ep12 ep1 ep2 ep3 real


n1 = [1 0]';
n2 = [-1/2 sqrt(3)/2]';
n3 = [-1/2 -sqrt(3)/2]';

E = [ep11 ep12
     ep12 ep22];

ep1 = n1'*E*n1;
ep2 = n2'*E*n2;
ep3 = n3'*E*n3;

A = [diff(ep1, ep11) diff(ep1, ep22) diff(ep1, ep12);
     diff(ep2, ep11) diff(ep2, ep22) diff(ep2, ep12);
     diff(ep3, ep11) diff(ep3, ep22) diff(ep3, ep12)];

inv(A)*[ep1; ep2; ep3]

% ------------------------------------------------------
ep1 = 10;
ep2 = 6;
ep3 = 4;

e = eval(inv(A)*[ep1; ep2; ep3]);

X = [e(1); -e(3)];
Y = [e(2); e(3)];
C = (X+Y)/2;
D = [Y(1); X(2)];
r = norm(X-C);
plot([X(1) Y(1) C(1) D(1)],[X(2) Y(2) C(2) D(2)],'.')
hold on
t = 0:.01:2*pi;
xm = C(1) + r*cos(t);
ym = C(2) + r*sin(t);
plot(xm,ym)
plot(C(1)+[-2*r 2*r],[0 0],'k',[0 0],[-2*r 2*r],'k')

t = -2*r:0.01:2*r;
xn1 = D(1) + n1(1)*t;
yn1 = D(2) + n1(2)*t;

xn2 = D(1) + n2(1)*t;
yn2 = D(2) + n2(2)*t;

xn3 = D(1) + n3(1)*t;
yn3 = D(2) + n3(2)*t;
plot(xn1,yn1,xn2,yn2,xn3,yn3)


hold off
axis equal
grid on
xlabel('\epsilon_n')
ylabel('\epsilon_{mn}')





