function f = nod_eval_nlin_2O(x,D_intra,D_iso,G_mag,Del,del,g,b,sigma,ydata1)
OD1 = x(1);
sinT1=sin(x(2));
cosT1=cos(x(2));
sinP1=sin(x(3));
cosP1=cos(x(3));
v_ic1=x(4);
n1=[cosP1*sinT1 sinP1*sinT1 cosT1];
OD2 = x(5);
sinT2=sin(x(6));
cosT2=cos(x(6));
sinP2=sin(x(7));
cosP2=cos(x(7));
n2=[cosP2*sinT2 sinP2*sinT2 cosT2];
v_ic2=x(8);
%%%%%%%%%%%%%%%%%%%%%%%%%  IntraCellular ic1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
kappa1 = 1 ./ tan(OD1*pi/2);
signal_ic1 = SynthMeasWatsonSHCylNeuman_PGSE( [D_intra 0 kappa1], g, G_mag, Del, del, n1', 0 );
nG3=signal_ic1(:,1);
%%%%%%%%%%%%%%%%%%%%%%%% Extra Cellular ec1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
d_perp=D_intra * (1 - v_ic1);
signal_ec1 = SynthMeasWatsonHinderedDiffusion_PGSE( [D_intra d_perp kappa1], g, G_mag, Del, del, n1');
nG4=signal_ec1(:,1);
%%%%%%%%%%%%%%%%%%%%%%%%%  IntraCellular ic2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
kappa2 = 1 ./ tan(OD2*pi/2);
signal_ic2 = SynthMeasWatsonSHCylNeuman_PGSE( [D_intra 0 kappa2], g, G_mag, Del, del, n2', 0 );
nG5=signal_ic2(:,1);
%%%%%%%%%%%%%%%%%%%%%%%% Extra Cellular ec2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%v_ic=f1/(1-f3);
d_perp2=D_intra * (1 - v_ic2);
signal_ec2 = SynthMeasWatsonHinderedDiffusion_PGSE( [D_intra d_perp2 kappa2], g, G_mag, Del, del, n2' );
nG6=signal_ec2(:,1);
%%%%%%%%%%%%%%%%%%%%%%%%%  ISO %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
nG7= (D_iso * b); % Ball out put  
A_b=[nG3 nG4 nG5 nG6 exp(-nG7)];
a_hat=((inv(A_b'*A_b))*A_b')*ydata1;
y_hat=(A_b*a_hat)-sigma;
f=(ydata1-y_hat)'*(ydata1-y_hat);

