Advertisement
DearOohDeer

Schemat Aitkena-Wlasna Medota

Apr 14th, 2021
2,103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Octave 0.89 KB | None | 0 0
  1. format short
  2. x = [1.0 , 1.1 , 1.3 , 1.5 , 1.6]
  3. y = [1.0 , 1.032 , 1.091 , 1.145 , 1.170]
  4. a = 1.15;
  5. for i = 1:5
  6.   L(i,1) = x(i);
  7.   L(i,2) = x(i)-a;
  8.   L(i,3) = y(i);
  9.  endfor
  10. w_oc = polyval(polyfit(x,y,4),a) %wartosc wiel.interp. z Octave w punkcie a
  11. r=1;
  12. for i = 2:5
  13. L(i,4) = (1/(x(r+1) - x(r))) * abs(( y(r) * (x((r+1)) - a)) -  (y((r+1)) * (x(r) - a)));
  14. r++;
  15. endfor
  16. r=1;
  17. for i = 3:5
  18. L(i,5) = (1/(x(r+2) - x(r))) * abs(( L(i-1,4) * (x((r+2)) - a)) -  (L(i,4) * (x(r) - a)));
  19. r++;
  20. endfor
  21. r=1;
  22. for i = 4:5
  23. L(i,6) = (1/(x(r+3) - x(r))) * abs(( L(i-1,5) * (x((r+3)) - a)) -  (L(i,5) * (x(r) - a)));
  24. r++;
  25. endfor
  26. L(5,7) = (1/(x(5) - x(1))) * abs(( L(4,6) * (x(5) - a)) -  (L(5,6) * (x(1) - a)));
  27.  format short;
  28.  L
  29.  format long;
  30.  wynik = L(5,5+2);
  31.  bl= abs(L(5,5+2) - L(5-1,5+1)); % Roznica dwoc
  32.  wd = cbrt(1.15)
  33.  bl
  34.  wynik
  35.  brz = abs(wd-wynik)
  36.  brz <= bl % Czy dobre szacowanie bledu
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement