对二元向量函数integral2数值积分报错:对于此运算,数组大小不兼容的问题。
显示 更早的评论
程序如下:fuce = @(x,y)fun(x,y);
q = integral2(fuce,0,1,0,1)
function [a] = fun(x,y)
a = sin((1:5).*x + 2.*y);
end
想对此二元函数进行数值积分,但总出现报错:对于此运算,数组的大小不兼容。求教大神应该如何修改呐?
但把function定义的函数改为一元函数之后,就可以积分了:
fuce = @(x)fun(x);
q = integral2(fuce,0,1,'ArrayValued',true)
function [a] = fun(x)
a = sin((1:5).*x);
end
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 编程 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!