% Unit 4 (MATLAB Course @ UAM)
% (c) Alexander Knebe

%=======================================================================
% normalise the integral over N(x) to unity
% Note:
%   we expect the number of elements in N() and x() to be identical
%=======================================================================
function [p] = normalise(N,x)

dx = diff(x);
Fi = (N(1:end-1)+N(2:end))./2 .* dx;

Imid = sum(Fi);

p = N./Imid;

end