Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function result = gauss( f, a, b, n )
- len=abs(b-a)/n;
- result = 0;
- for i=1:n
- result = result + g3(f,a+(i-1)*len, a+i*len);
- end
- end
- function y = g3(f,a,b)
- c1=(b-a)/2;
- c2=(a+b)/2;
- A = [ 0.347855 0.652145 0.652145 0.347855]; % współczynniki A0 A1 A2 A3 stablicowane
- xk = [ -0.861136 -0.339981 0.339981 0.861136]; % wartości x0 x1 x2 x3 stablicowane
- x = c1*xk+c2; %obliczenie rzeczywistych x
- y=c1*(sum(A.*f(x))); % ((b-a)/2)*(A0*f(x0)+A1*f(x1)+A2*f(x2)+A3*f(x3))
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement