Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function sum (xlow, xhigh, eps)
- %метод центральных прямоугольников
- n = 2;
- h = (xhigh-xlow)/n;
- Itstop = 0;
- Inprev = 0;
- while (Itstop ~= 1);
- S = 0;
- for k=1:1:n
- x = xlow+k*h-h/2;
- S = S + funAr1(x);
- end
- Integral1 = S*h;
- if (abs(Integral1 - Inprev)<eps)
- Itstop = 1;
- else
- n = n*2;
- h = h/2;
- Inprev = Integral1;
- end
- end
- Integral1=2*pi*Integral1;
- %метод центральных прямоугольников
- n = 2;
- h = (xhigh-xlow)/n;
- Itstop = 0;
- Inprev = 0;
- while (Itstop ~= 1);
- S = 0;
- for k=1:1:n
- x = xlow+k*h-h/2;
- S = S + funAr(x);
- end
- Integral2 = S*h;
- if (abs(Integral2 - Inprev)<eps)
- Itstop = 1;
- else
- n = n*2;
- h = h/2;
- Inprev = Integral2;
- end
- end
- Integral2=2*pi*Integral2;
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement