Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. % ZAD 2
  2. clear;
  3. close all
  4. clc
  5.  
  6. a=2;
  7. b=12;
  8. n=3;
  9. x = linspace(a,b,n+1);
  10. xbis = linspace(a,b,500);
  11. y=sin(x)+cos(x);
  12. ybis=sin(xbis)+cos(xbis);
  13. y11= interp1(x,y,xbis,'spline');
  14.  
  15. % hold on
  16. % title('DRUGI lin')
  17. plot(x,y,'o',xbis,y11);
  18. blad_s11 = max(abs(ybis-y11))
  19.  
  20.  
  21. y12= interp1(x,y,xbis,'linear');
  22.  
  23. hold on
  24. plot(x,y,'o',xbis,y12, 'b');
  25. blad_s12 = max(abs(ybis-y12))
  26. d1=ybis-y12;
  27. d2=ybis-y11;
  28. subplot(211), plot(xbis, d1)
  29. subplot(212), plot(xbis, d2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement