Integrate a function that contains a built-in function
古いコメントを表示
Hi,
I'm trying to integrate an anonymous function that contains a built-in function. Here's the code:
if true
fun = @(x,d) (exp(-0.5 * (x - d).^2) * (sign(x)))/(sqrt(2*pi));
q = integral(@(x)fun(x,M(l,i)),-inf, inf
end
Not sure what is causing the problem but it is giving me these error messages:
Error using * Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the number of rows in the second matrix. To perform elementwise multiplication, use '.*'.
Error in FILENAME>@(x,d)(exp(-0.5*(x-d).^2)*(sign(x)))/(sqrt(2*pi))
Error in FILENAME>@(x)fun(x,M(l,i))
Error in integralCalc/iterateScalarValued (line 314) fx = FUN(t);
Error in integralCalc/vadapt (line 132) [q,errbnd] = iterateScalarValued(u,tinterval,pathlen);
Error in integralCalc (line 103) [q,errbnd] = vadapt(@minusInfToInfInvTransform,interval);
Error in integral (line 88) Q = integralCalc(fun,a,b,opstruct);
Error in FILENAME (line 77) q = integral(@(x)fun(x,M(l,i)),-inf, inf)
I have no idea why there's an issue with matrix multiplication, as far as I am concerned there are no matrices being multiplied here.
Any help would be greatly appreciated.
回答 (1 件)
カテゴリ
ヘルプ センター および File Exchange で Mathematics についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!