Delta=1
x=linspace(2,10,9)
y=1./x;
I=SimpsonByOoi(y,Delta)
%Check with MATLAB
Imatlab=Delta*trapz(y)
function I=SimpsonByOoi(y,dx)
n=length(y);
I=(dx/3)*(y(1)+4*sum(y(2:2:end))+2*sum(y(3:2:end-1))+y(n));
end
Delta=1
x=linspace(2,10,9)
y=1./x;
I=SimpsonByOoi(y,Delta)
%Check with MATLAB
Imatlab=Delta*trapz(y)
function I=SimpsonByOoi(y,dx)
n=length(y);
I=(dx/3)*(y(1)+4*sum(y(2:2:end))+2*sum(y(3:2:end-1))+y(n));
end