function [a] = wlsp(wa,m,L)
% function [a] = wlsp(wa,m,L)
%
%    Weighted-Sum Line Spectrum Pair (WLSP) filter generation.
%
%    Input variables:
%       wa   - signal
%       m    - model order
%       L    - number of autocorrelation values (above m) to use 
%              in model matching (default: 2*m)
%    Output variable:
%       a    - filter coefficients for WLSP
%
%    This function is an appendix to the article "All-pole Modeling 
%    Technique Based on the Weighted Sum of the LSP Polynomials",
%    presented at ICASSP'02. 
%
%    See also: LSPFIT, LSP, LSPX

% Tom Bäckström / 11.10.2001

% check optional input variables
if nargin < 3
  L = 2*m;
end;

% calculate LPC coefficients for model order m-1

al = lpc(wa,m-1);


% calculate WLSP coefficients for model order m

a = lspfit(al,wa,L);
