%mStruct.p.mu1=1;
%mStruct.p.k1=2;
%mStruct.p.alpha=3;
%mStruct.p.g1=4;
%mStruct.p.Kg=5;
%mStruct.p.k2=6;
%mStruct.p.g2=7;


par = p;

clear x0

x0(1)       = par(3)/par(4);
x0(2) 		= par(5)/par(6)*x0(1);
%x0(1)       = 0;
%x0(2)       = 0;
x0(3)       = par(3)/par(4);
x0(4)       = par(5)/par(6)*x0(3);
%x0(3)       = 0;
%x0(4)       = 0;

reltols = 1e-14;
abstols = 1e-14;

nt = t(1) : 0.1 : t(end);
[nt,x] = odeGAL1p( nt, x0, p(1:6), input, [reltols abstols 10] );
[dnt,dx] = odeGAL1p( t, x0, p(1:6), input, [reltols abstols 10] );

y1 = par(1)*(dx(2,:));
y2 = par(1)*(dx(4,:));

dataE = dE(:)';

kg2(1) = 1.769292045467269;
kg2(2) = 20.589996419308118;

kk1(1) = -1.492365943401997;
kk1(2) = 0.660794593704535;


figure(1);
clf
subplot( 2, 1, 1 );

plot( t, dE(:,1), '.' );
hold on;
errorbar( t, dE(:,1), dE(:,1).*0+p(7), '.r' );
plot( nt, p(1)*x(2,:),'.-g' );
%title(num2str(log(sum(res.^2))))

subplot( 2, 1, 2 );
plot( t, dE(:,2), '.' );
hold on;
errorbar( t, dE(:,2), dE(:,2).*0+p(8), '.r' );
plot( nt, p(1)*x(4,:),'.-g' );