TRIGPOL generate trigonometric polynomial. TRIGPOL(N) generates the following polynomial in e^jw: P(e^jw)=sum(k=0,...,N-1){ (N-1+k) ( e^(-jw) - 2 + e^jw ) k The output of the function is a vector of size 2*N-1 holding the coefficients corresponding to the different powers of e^jw. See also: NUMCOMB, DAUB, SPLINE
0001 function polinomio=trigpol(N) 0002 0003 % TRIGPOL generate trigonometric polynomial. 0004 % 0005 % TRIGPOL(N) generates the following polynomial in e^jw: 0006 % 0007 % P(e^jw)=sum(k=0,...,N-1){ (N-1+k) ( e^(-jw) - 2 + e^jw ) 0008 % k 0009 % 0010 % The output of the function is a vector of size 2*N-1 holding 0011 % the coefficients corresponding to the different powers of e^jw. 0012 % 0013 % See also: NUMCOMB, DAUB, SPLINE 0014 0015 0016 %-------------------------------------------------------- 0017 % Copyright (C) 1994, 1995, 1996, by Universidad de Vigo 0018 % 0019 % 0020 % Uvi_Wave is free software; you can redistribute it and/or modify it 0021 % under the terms of the GNU General Public License as published by the 0022 % Free Software Foundation; either version 2, or (at your option) any 0023 % later version. 0024 % 0025 % Uvi_Wave is distributed in the hope that it will be useful, but WITHOUT 0026 % ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0027 % FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0028 % for more details. 0029 % 0030 % You should have received a copy of the GNU General Public License 0031 % along with Uvi_Wave; see the file COPYING. If not, write to the Free 0032 % Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 0033 % 0034 % Author: Nuria Gonzalez Prelcic 0035 % e-mail: Uvi_Wave@tsc.uvigo.es 0036 %-------------------------------------------------------- 0037 0038 0039 %The polynomial is constructed from a sum. 0040 %coefs holds the coefficients of each term in the sum. 0041 0042 coefs=zeros(N,2*N-1); 0043 coefs(1,N)=1; 0044 0045 0046 for i=1:N-1 0047 fila=[1 -2 1]; 0048 for j=2:i 0049 fila=conv(fila,[1 -2 1]); 0050 end; 0051 fila=numcomb(N-1+i,i)*(-0.25)^i*fila; 0052 fila=[ zeros(1,(N-i-1)) fila zeros(1,(N-i-1))]; 0053 coefs(i+1,:)=fila; 0054 end 0055 0056 for i=0:(2*(N-1)) 0057 polinomio(i+1)=0; 0058 for j=1:N 0059 polinomio(i+1)=polinomio(i+1)+coefs(j,i+1); 0060 end 0061 end;