Meizi Yu-hw4 - Meizi Yu Math 104A HW4 1(a%Lebesgue function function LF=Lebesgue_function(x,z%x are interpolating nodes and z are evaluating points

Meizi Yu-hw4 - Meizi Yu Math 104A HW4 1(a%Lebesgue...

This preview shows page 1 - 5 out of 5 pages.

Meizi Yu Math 104A HW4 1. (a) %Lebesgue function function LF=Lebesgue_function(x,z) %x are interpolating nodes and z are evaluating points n=length(x); L=ones(1,n); for i = 1:n for j = 1:nh7 if j~=i L(i) = L(i)*((z - x(j))/(x(j)-x(i))); end end end LF=sumabs(L); end (b) clear; clc; n=4; x=zeros(1,n+1); for j=1:n+1 x(j)=-1+(j-1)*(2/n); end m=1000; LF=zeros(1,m+1); z=zeros(1,m+1); for k=1:m+1 z(k)=-1+(k-1)*(2/m); LF(k)=Lebesgue_function(x,z(k)); end plot(z,LF); xlabel ( 'points' ); ylabel ( 'Lebesgue function' ); title( 'n=4' ) LC=norm(LF,Inf); disp( 'Lebesgue constant is' ); disp(LC)
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1 1 1.5 2 2.5 points Lebesgue function n=4 Lebesgue constant is 2.2078 for n=4 -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1 0 5 10 15 20 25 30 points Lebesgue function n=10 Lebesgue constant is 29.8981 for n=10

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture