Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
21 lines (20 sloc) 639 Bytes
% func: Funktion
% a: Untere Grenze Intervall
% b: Obere Grenze Intervall
% n: 1, 2, oder 3 [Gauss der Ordnung n)
% Gauss:
% Bsp aus Skript Aufgabe 6.9:
% Gauss(@(x) exp(-x^2), 0, 0.5, 1)
function [x] = Gauss(func, a, b, n)
format long
x = 0;
if (n == 1)
x = (b-a) * func((b+a)/2);
elseif (n == 2)
x =(b-a)/2 * (func((-1/sqrt(3) * (b-a)/2) + (b+a)/2) + func(((1/sqrt(3)) * (b-a)/2) + (b+a)/2));
elseif (n == 3)
x = (b-a)/2 * (5/9 * func(-sqrt(0.6) * ((b-a)/2) + ((b+a)/2)) + ...
8/9 * func((b+a)/2)) ...
+ (b-a)/2 * (5/9 * func(sqrt(0.6) * ((b-a)/2) + ((b+a)/2)));
end
end
You can’t perform that action at this time.