function [op,SINGULAR] = findop(D,opspec)
% Compute operating condition.

%   Copyright 2023 The MathWorks, Inc.
nx = size(D.a,1);
[ny,nu] = iosize(D);
nfd = numel(D.Delay.Internal);
opspec = validate_x(opspec,nx,ny,nu,nfd);
A = D.a;
E = D.e;
if isempty(E)
   E = eye(nx,'like',A);
end
if D.Ts~=0
   A = A-E;
end
[f,g] = getAffineOffsets(D);
[op,SINGULAR] = ltipack.numerics.findop(A,D.b,D.c,D.d,E,f,g,...
   opspec.x,opspec.u,opspec.w,opspec.dx,opspec.y);
if D.Ts~=0
   op.dx = op.dx+op.x;  % return x[k+1]
end
