function sheet3_public %DRIVER_7p1 DRIVER_7p6 return %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function DRIVER_7p1 f = chebfun('sin(100*x)./(1+x.^2)'); fprintf(1,'Total varation of f = %0.8f\n',norm(diff(f),1)) plot(f) grid on keyboard return %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function DRIVER_7p6 flag_option = 1; s = linspace(-1,1,10); f = @(x) exp(x); %f = @(x) sin(23*x); fspline = @(x) spline(s,f(s),x); p = chebfun(fspline); figure(1) hold off tt = linspace(-1,1,1000); plot(tt,f(tt),'b',... tt,fspline(tt),'r',... s,f(s),'kx',... 'LineWidth',2) legend('f','spline') figure(2) hold off aa = chebcoeffs(p); nn = 1:length(aa); loglog(nn,abs(aa),'b.',... nn,nn.^(-4),'r--',... 'LineWidth',2,... 'MarkerSize',20) xlabel('n') legend('|a_n|','n^{-4}') title('Decay of Chebyshev coefficients for a spline.') keyboard return %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%