How to apply numerical integration on a symbolic matrix?
2 ビュー (過去 30 日間)
古いコメントを表示
Can I use integral2 to calculate the matrix below on the domain[0,1]*[0,1];

My matrix is much more complicated than this one, and I do not want to calculate the symbolic expression one by one~
0 件のコメント
採用された回答
Andrei Bobrov
2016 年 9 月 26 日
編集済み: Andrei Bobrov
2016 年 9 月 26 日
Please try this is code:
fun = {@(x,y)x+y,@(x,y)x.^2+y.^2;@(x,y)x-y,@(x,y)x.^2-y.^2}
q = cellfun(@(z)integral2(z,0,1,0,1),fun);
or let fs - a your symbolic matrix, then
fun = zeros(size(fs));
for jj = 1:numel(fs)
fun = matlab2Function(fs(jj));
out(jj) = integral2(fun, 0, 1, 0, 1);
end
2 件のコメント
Ali SeyedKavoosi
2018 年 6 月 24 日
my Matlab does not recognize matlab2Function. Is it in any update or app?
Hadi alimohammadi
2021 年 11 月 4 日
i have same problem!!!
Matlab2Function is not known function for matlab.
その他の回答 (1 件)
KSSV
2016 年 9 月 26 日
syms x y
A = [x+y x^2+y^2 ; x-y x^2-y^2] ;
X = int(A,x,0,1); % integrate w.r.t x between limits 0 and 1
Y = int(A,y,0,1) ; % integrate w.r.t y between limits 0 and 1
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!