Clear Filters
Clear Filters

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

1 view (last 30 days)
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

Answers (1)

Torsten
Torsten on 3 May 2023
Edited: Torsten on 3 May 2023
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

Categories

Find more on Tables in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!