I create two functions fx and fy as follows:
fx = @(x) ncx2pdf(x, 10, 1); fy = @(y) ncx2pdf(y + 25, 10, 10);
Then, I define fs function as follows:
shift = 0 fs = @(s) fx(s) .* fy(shift - s)
Note that fs is always positive (product of two probability density function). If I compute:
integral(fs, -Inf, 100)
I obtain the true value 0.0413, but If I compute
integral(fs, -Inf, 1000)
I obtain 0. Why this strange behavior happens using integral function? Note that if I compute
integral(fs, -Inf, Inf)
I obtain the true value 0.0413.
Best Answer