function with integral inside
显示 更早的评论
I'm having trouble trying to write a 2d function with vectorized inputs that has an integral inside.
My function is as follows:
thick = 40e-9;
overlap = (@(E,T)integral2(@(x,y)exp(E.*T.*abs(x-y)),0,thick,0,thick));
If I call the function with scalar inputs, e.g. overlap(1,1), this works fine.
overlap(1,1)
ans = 1.6000e-15
However, if I call the function with vector inputs for E and T, e.g. E=1:1:10 and T=1:1:10, this does not work. I get the following:
Error using .*
Matrix dimensions must agree.
Does anyone know how to make this work with vectorized inputs?
Thanks in advance!
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Numerical Integration and Differentiation 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!