I have the following matlab function:
function y=par(x,s)
%parabolic density function with basis = 2s
y=0*x;
ind=-s<x & x< s;
y(-s<x & x< s)=(3/(4*(s^3)))*(s*s-x(ind).*x(ind));
This function implements
$$y_s(x) = \begin{cases} \frac{3}{4s^3}(s^2-x^2) & \text{if } -s<x<s, \\ 0 & \text{otherwise.} \end{cases}$$
The area under the parabola is always one. I tested it with the following matlab procedure:
s = 0.5:0.1:100.5;
for i=1:length(s)
q = quad(@(x)par(x,s(i)),-s(i),s(i));
end
q is always 1 here.
btw. quad is a matlab function to evaluate the integral. Here it calculates $q = \int_{-s}^s y_s(x)\,dx$.
Can somebody explain to me why it is always one ?
