Facebook
From Silly Mosquito, 1 Year ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 131
  1. clear
  2. format LONGE
  3. k=1000;
  4. d=10^(-3);
  5. h=d/500;
  6. x=linspace(2-d,2+d,k);
  7.  
  8. A1=(x-2).^4;
  9. A2=x.*x.*x.*x-8.*x.*x.*x+24.*x.*x-32.*x+16;
  10. AERR=abs((((2-d+x.*h)-2).^4)-((2-d+x.*h).*(2-d+x.*h).*(2-d+x.*h).*(2-d+x.*h)-8.*(2-d+x.*h).*(2-d+x.*h).*(2-d+x.*h)+24.*(2-d+x.*h).*(2-d+x.*h)-32.*(2-d+x.*h)+16));
  11. maxk=max(AERR);
  12. disp('maxk: ');
  13. disp(maxk);
  14. plot(x,A1,'r',x,A2,'g',x,AERR,'k');
  15.  
  16. grid
  17. legend('f1', 'f2','measurement error ') ;
  18.