# How to use an integral inside another integral

7 views (last 30 days)
may on 19 Sep 2013
Commented: may on 27 Sep 2013
I have the following code:
F=@(y) find_integral(z-y).*find_integral(y);
end
F = @(x)normpdf(x).*normpdf(u./x);
end
When I call the function find_integral2(4), I get the following error:
Error using ./ Matrix dimensions must agree.
I know I can solve this with triple integral but I want to call find_integral2 several times, i.e. , I want to again use it in another function:
I would appreciate if you could help me fix this error. Thank you.

Mike Hosea on 23 Sep 2013
Either this (find_integral is unchanged)
F=@(y) arrayfun(@(y)find_integral(z-y).*find_integral(y),y);
end
or this
F=@(y) find_integral(z-y).*find_integral(y);
end
may on 27 Sep 2013
Thanks a lot for your help again. so now using 'AbsTol',1e-5,'RelTol',1e-3, I could speed up the function find_integral3(z) (mentioned above), but now I want to again use it to calculate the following integral (this is actually the final problem I want to solve)
F = @(y)find_integral3(z)(z-y).*find_integral3(y);
Even after around 8 hours, it did not terminate! I would appreciate if you could help me again.