How to Double integrate cell of array containing cell of array?

3 ビュー (過去 30 日間)
Richard Johnson
Richard Johnson 2023 年 5 月 3 日
編集済み: Torsten 2023 年 5 月 3 日
Hello,
I have been trying to double integrate a cell of array containing cell of array/objects. However i am not able to get the required result and convert the result inot a matrix of same order (nxn). The screenshot of the same has been attached for reference.
Info regarding the Variables used in code as you in the screenshot attached:-
W{i,j} = 25 x 25 cell, where each cell contains the functions of variable "theta and phi".
Objective is to double integrate the W cell with respect to theta and phi within the limits of zero to pi/2 & zero to 2*pi respectively.
then, followed by converting the result into a matrix of 25x25 order, post compltion of the integration.
Request if someone may please show some guidance for the afpre mentioned problem.
Thanks in advance
Regards
Richard

回答 (1 件)

Torsten
Torsten 2023 年 5 月 3 日
編集済み: Torsten 2023 年 5 月 3 日
Works. If your problem is more complicated, you will have to include the code as plain text (no graphics) in order to see where you get problems.
W = cell(2,2);
W{1,1} = @(theta,phi) sin(theta);
W{1,2} = W{1,1};
W{2,1} = W{1,1};
W{2,2} = W{1,1};
Wnum(1,1) = integral2(W{1,1},0,pi/2,0,2*pi)
Wnum = 6.2832

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by