function [sys]=slug_wrapper(z)
% Aucillary function for the proyden secant line trace
%
global IX IU IFIXU data x_pred n uorg
x=z(IX);u=z(IU);
xdiff=slug_3D_sim(0,x,u,'derivatives',data);
% Fix elements of u-vector
ufix=uorg;
ufixerr=u(IFIXU)-ufix(IFIXU);
corrdirerr=n'*(z-x_pred);


sys=[xdiff;ufixerr;corrdirerr];