フィルターのクリア

How can I calculate the integral2 using sum of prod?

2 ビュー (過去 30 日間)
Han
Han 2020 年 1 月 5 日
編集済み: Vladimir Sovkov 2020 年 1 月 5 日
syms m r theta
xm = 1:29;
ym = 1:29;
fun = @(r,theta) (...
symprod((1 - exp(((1 - sqrt((r.*cos(theta)-(xm(m))).^2 + (r.*sin(theta)-(ym(m))).^2))))),m, 1, 29 )...
);
solve = integral2(fun,0,30,0,2 * pi);
How can I solve this problem?

採用された回答

Vladimir Sovkov
Vladimir Sovkov 2020 年 1 月 5 日
編集済み: Vladimir Sovkov 2020 年 1 月 5 日
symprod does not support the element-wise multiplication, which is needed for integral2.
You sholuld probably define your fun via a little longer code with the element-wise operations, e.g.
xm = 1:29;
ym = 1:29;
fun = @(r,theta)(1-exp(((1-sqrt((r.*cos(theta)-(xm(1))).^2+(r.*sin(theta)-(ym(1))).^2)))));
for k=2:numel(xm)
fun = @(r,theta) fun(r,theta) .* (1-exp(((1-sqrt((r.*cos(theta)-(xm(k))).^2+(r.*sin(theta)-(ym(k))).^2)))));
end
solve = integral2(fun,0,30,0,2 * pi)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCalculus についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by