function et = romberg(t) % % function et = romberg(t) % % Applies extrapolation to the approximations in t, % t is a sequence of results of the composite Trapezoidal rule. % % Example: % t = adaptrap('sin',0,pi/2,6) % et = romberg(t); % n = size(t,1); et = zeros(n,n); et(:,1) = t; for i = 2:n m = 2; for j = 2:i r = 2^m; et(i,j) = (r*et(i,j-1) - et(i-1,j-1))/(r - 1); m = m+2; end; end;