function [Q0,R0] = fnfilt(C0,D0,B0,A0,M0,N0,S,T,rho,m,k)

% function [Q0,R0] = fnfilt(C0,D0,B0,A0,M0,N0,S,T,rho,m,k)      MS 92-02-21
%
% (function-version of nfilt.)
% Computes NOMINAL WIENER FILTER Q0/R0 from a nominal signal model
%
%         B0           MO                 C0
% y(t) = ----u(t-k) + ----v(t) ;  u(t) = ----e(t)  ; E|v|^2/E|e|^2 = rho
%         A0           NO                 D0
%
% Estimated signal:   f(t-m)= (S/T)u(t-m)
% Estimator:    fhat(t-m|t) = (Q0/R0)y(t).
%
% The polynomials may have complex coefficients.
%
% USES: abstar, addcent, spefac2, polysolve.

% Prepare right-hand side of spectral factorization, and solve it.
CC=abstar(C0,C0);
right1 = conv(CC,conv(abstar(B0,B0),abstar(N0,N0)));
right2 = rho*conv(abstar(M0,M0),conv(abstar(A0,A0),abstar(D0,D0)));
right  = addcent(right1,right2);
[beta0,r0]=spefac2(right);

% Solve Diophantine equation.
[Q10,L0,s,h]=polysolve(S,CC,B0,N0,r0*beta0,conv(D0,T),m,k);
Q0 = conv(Q10,conv(A0,N0));
R0 = conv(beta0,T);
