Home > sgwt_toolbox > demo > chebyapprox.m

chebyapprox

PURPOSE ^

%

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

%
test
%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %%
0002 %test
0003 %%
0004 
0005 % gs2=@(x) g(s(6)*10*x);
0006 %
0007 % c1=sgw_cheby_coeff(gs1,m,m+1,[lmin lmax]);
0008 % c2=sgw_cheby_coeff(gs2,m,m+1,[lmin lmax]);
0009 %
0010 % plot(y,gs1(y),y,gs2(y));
0011 gs=@(x) g(s(2)*x);
0012 
0013 y=linspace(lmin,lmax,2*N);
0014 m=10;
0015 c=sgw_cheby_coeff(gs,m,1e3,[lmin lmax]);
0016 
0017 a1=(lmax-lmin)/2;
0018 a2=(lmax+lmin)/2;
0019 
0020 y=linspace(lmin,lmax,2*N);
0021 Tw(1,:)=ones(size(y));
0022 Tw(2,:)=(y-a2)/a1;
0023 
0024 aw=zeros(size(y));
0025 aw=.5*c(1)*Tw(1,:)+c(2)*Tw(2,:);
0026 for j=2:m
0027   Tw(j+1,:)=2*((y-a2)/a1).*Tw(j,:)-Tw(j-1,:);
0028   aw=aw+c(j+1)*Tw(j+1,:);
0029 end
0030 
0031 subplot(1,2,1);
0032 plot(y,aw,y,gs(y));
0033 subplot(1,2,2);
0034 plot(y,aw-gs(y));
0035 ym=max(abs(ylim)); ylim([-ym ym]);
0036 err=max(abs(aw-gs(y)));
0037 title(sprintf('err %g',err));

Generated on Fri 30-Apr-2010 17:49:57 by m2html © 2003