function x0 = backcast_frequency(a,b,c,d,id,yuf,IsReal,sqrlam,linearSolver,sys)
% Estimate x0 for backcast case. No specs are needed for estimation since
% all states are unconstrained.
%
% sys: template ss model. Passed as an input argument because
% creating on the fly is somewhat expensive; now instantiated in
% configureOptimizationOptions.
%
% Assumes K=0. If frequency domain identification starts supporting general
% predictors, this will have to be updated to be similar to backcast_time.

% Copyright 2007-2010 The MathWorks, Inc.

% Old way:
% X01 =  x0est_f(z,A,B,C,D,struc.k,ny,nu,maxsize,M,sqrlam);

sys.a = a; sys.b = b; sys.c = c; sys.d = d; 
if any(id), sys.Delay.Input = id; end
%x0 = x0est(sys, data, [], x0estOpt);
nx = size(a,1);
[J, e] = x0estFreqErrorJac(sys, yuf,zeros(nx,1), true(nx,1), IsReal, sqrlam);
x0 = linearSolver(J,e);
