clear all close all [D,x]=cheb(4); x_hd=-1:0.01:1; y=sin(pi*x); y_hd=sin(pi*x_hd); v=[0 0.8 0 -0.8 0]; T0=1; T1=x; T2=2*x.*T1-T0; T3=2*x.*T2-T1; T4=2*x.*T3-T2; fox=v(1)*T0+v(2)*T1+v(3)*T2+v(4)*T3+v(5)*T4; figure plot(x,zeros(length(x)),'o') hold on plot(x_hd,y_hd,'b','linewidth',2) plot(x,fox,'r','linewidth',2) dy=D*y; plot(x,dy,'g','linewidth',2)