em1=[];em2=[];inc=0.01;em2em1=[];m2em1_m1em2=[];m2em1m1_m1em2m1=[];
yav=[];yng=[];Zav=[];Zng=[];beta=[];gamma=[];ert=[];den=[];
T=1/4000;E=15;L=0.020;R=50;%C=1e-06;
	C=1e-06;
	cte=1/(R*C);
   cte2=1/(L*C);
   radical=sqrt((cte/2)^2-cte2);
	m_1=-cte/2-radical;     												% memoria 9      
   m_2=-cte/2+radical;														% memoria 8
   coef1=E/L*T; coef2=E/L; 
   mu=0:inc:1-inc;
   unos=ones(1,1/inc);                              
   ert(1,:)=exp(-mu(1,:)*T*cte);											% memoria 7
   em1(1,:)=exp(m_1*(unos(1,:)-mu(1,:))*T); 							%memoria 1
   em2(1,:)=exp(m_2*(unos(1,:)-mu(1,:))*T); 							%memoria 2
   em2em1(1,:)=em2(1,:)-em1(1,:);										%memoria 3
   rizo(1,:)=coef1*mu(1,:);
	m2em1_m1em2(1,:)=m_2*em1(1,:)-m_1*em2(1,:);						%memoria 4
	m2em1m1_m1em2m1(1,:)=m_2*( 1-em1(1,:) )-m_1*( 1-em2(1,:) );	%memoria 5
beta(1,:) = m2em1_m1em2 /(m_2-m_1); gamma(1,:)= em2em1/(m_2-m_1);
%Y infinito negativo.
yng(1,:)=( m2em1_m1em2(1,:).*mu(1,:)*coef1 )./ m2em1m1_m1em2m1(1,:)+...
      +( em2em1(1,:)*coef2 )./ m2em1m1_m1em2m1(1,:)+...
      +(E/R)*( m2em1m1_m1em2m1(1,:) )./ m2em1m1_m1em2m1(1,:);
%Y average.
yav(1,:)=yng(1,:).*( 1+rizo(1,:)/2 );

 den(1,:)=m_2-m_1-m2em1_m1em2(1,:)+cte*ert(1,:).*em2em1(1,:);
%den(1,:)=m_2-m_1-ert(1,:).*m2em1_m1em2(1,:)+cte*ert(1,:).*em2em1(1,:);
Zng(1,:)=(  E*( m_2*(1-em2(1,:))-m_1*(1-em1(1,:)) )  )./den(1,:);
Zav(1,:)= Zng(1,:).*( unos(1,:)+ert(1,:) )*1/2;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% [m_1*0.001 m_2*0.001 mu(1,61) yng(1,61) yav(1,61) Zng(1,61) Zav(1,61) ert(1,61)]
subplot(221),plot(mu,Zav)
%title('Z_{average} vs \mu_{\infty} L=0.02,E=15,C=1x10^{-06},R=50')
xlabel('\mu_{\infty}')
ylabel(' z_{av}(\infty)')
axis([0 1 0 150]);
subplot(222),plot(mu,yng(1,:))
%title('y^{-}_{\infty} vs \mu_{\infty}')
xlabel('\mu_{\infty}')
ylabel('y^{-}_{\infty}')
axis([0 1 0 2.5]);
subplot(223),plot(Zav,yng(1,:))
%title(' y^{-}_{\infty} vs Z_{average}')
ylabel('y^{-}_{\infty}')
xlabel(' z_{av}(\infty)')
axis([0 100 0 2.5]);
subplot(224),plot3(mu,yng(1,:),Zav), grid
%title('Z_{average} vs \mu_{\infty} and y^{-}_{\infty} vs \mu_{\infty} ')
xlabel('\mu_{\infty}')
zlabel(' z_{av}(\infty)')
ylabel('y^{-}_{\infty}')
%axis([0 1 0 2.5 0 750]);
