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 the fs function as follows:
shift = 0 fs = @(s) fx(s) .* fy(shift - s)
Note that fs is always positive (the product of two probability density functions). If I calculated:
integral(fs, -Inf, 100)
I get the true value 0.0413, but if I calculated
integral(fs, -Inf, 1000)
I get 0. Why does this weird behavior happen using an integral function? Please note that if I calculated
integral(fs, -Inf, Inf)
I get the true value of 0.0413.
source share