DearOohDeer

Schemat Aitkena - Szkolna Metoda

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