Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
20 lines (16 sloc) 381 Bytes
function [Rf] = Rechteckfunktion(func, a, b, n)
% func: Funktion
% a: Untere Grenze Intervall
% b: Obere Grenze Intervall
% n
% Rf:
% Bsp aus Skript Aufgabe 6.6:
% Rechteckfunktion(@(x)(1/x), 2, 4, 4)
h = (b-a)/n;
sum = 0;
for i=0:n-1
xi = a + i*h;
sum = sum + func(xi + (h/2));
end
Rf = h * sum;
end
You can’t perform that action at this time.