I want to integrate the function fun below. It consists of a variable X multiplied by the multi-variable pdf of X and the correlated variable Y.
I get the error message "Input function must return 'double' or 'single' values. Found 'sym'." (see below).
fun = @(Y,X) X .* mvnpdf([X Y],mu,sigma);
u = @(Y) log(C) + Y;
test = integral2(fun,-inf,inf,-inf,u);
Error using integral2Calc>integral2t/tensor (line 231)
Input function must return 'double' or 'single' values. Found 'sym'.
When I let X and Y be independent, so replace mvnpdf(....) by the product of their marginal pdfs, it works (then I redefine the variables and use lognpdf). I believe the error comes from the fact that my function fun gives symbolic output, even when supplied with arguments:
2*exp(- (5*conj(X) - conj(Y))^2/48 - conj(Y)^2/2 - 261924464376925987/144115188075855872)
But why is this? Is this the reason I cannot integrate my function? Grateful for help! Thanks!