# v_lpcrand

## PURPOSE

V_LPCRAND generate random stable polynomials AR=(P,N,BW)

## SYNOPSIS

function ar=v_lpcrand(p,n,bw)

## DESCRIPTION

    V_LPCRAND generate random stable polynomials AR=(P,N,BW)
     generate n random stable polynomials of order p with a minimum pole
     bandwidth of bw*fs where fs is the sampling fequency.
     To limit the pole radius to r set bw=-log(r)/pi
     bw may be a vector specifying a different max bandwidth for each row

## CROSS-REFERENCE INFORMATION

This function calls:

- v_lpcrf2ar V_LPCRF2AR Convert reflection coefs to autoregressive coefs [AR,ARP,ARU,G]=(RF)

This function is called by:

## SOURCE CODE

    0001 function ar=v_lpcrand(p,n,bw)
    0002 %V_LPCRAND generate random stable polynomials AR=(P,N,BW)
    0003 % generate n random stable polynomials of order p with a minimum pole
    0004 % bandwidth of bw*fs where fs is the sampling fequency.
    0005 % To limit the pole radius to r set bw=-log(r)/pi
    0006 % bw may be a vector specifying a different max bandwidth for each row
    0007
    0008 %      Copyright (C) Mike Brookes 1997-2018
    0009 %      Version: $Id: v_lpcrand.m 10865 2018-09-21 17:22:45Z dmb $
    0010 %
    0011 %   VOICEBOX is a MATLAB toolbox for speech processing.
    0012 %   Home page: http://www.ee.ic.ac.uk/hp/staff/dmb/voicebox/voicebox.html
    0013 %
    0014 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    0015 %   This program is free software; you can redistribute it and/or modify
    0016 %   it under the terms of the GNU Lesser General Public License as published by
    0017 %   the Free Software Foundation; either version 3 of the License, or
    0018 %   (at your option) any later version.
    0019 %
    0020 %   This program is distributed in the hope that it will be useful,
    0021 %   but WITHOUT ANY WARRANTY; without even the implied warranty of
    0022 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0023 %   GNU Lesser General Public License for more details.
    0024 %
    0025 %   You can obtain a copy of the GNU Lesser General Public License from
    0026 %   https://www.gnu.org/licenses/ .
    0027 %
    0028 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    0029
    0030 if nargin < 3
    0031    bw=0;
    0032    if nargin < 2
    0033       n=1;
    0034    end
    0035 end
    0036 if p
    0037    if ~bw
    0038       ar=v_lpcrf2ar(2*rand(n,p+1)-1);
    0039    else
    0040       k=exp(-pi*bw(:)*(0:p));
    0041       if size(k,1)==1
    0042          ar=v_lpcrf2ar(2*rand(n,p+1)-1).*k(ones(n,1),:);
    0043       else
    0044          ar=v_lpcrf2ar(2*rand(n,p+1)-1).*k;
    0045       end
    0046    end
    0047 else
    0048    ar=ones(n,1);
    0049 end