How to take double integral of a function matrix?
9 views (last 30 days)
Show older comments
Hello!
I have a matrix that consist of 2 variables (x,y) functions and i have to take double integral of it.
clear
clc
syms x y
a=1; b=1; t=1;
E=100/72; v=0.2;
x1=0; x2=b; x3=b; x4=0;
y1=0; y2=0; y3=a; y4=a;
B1 = [y-y4;0;x-x2];
B2 = [0;x-x2;y-y4];
B3 = [y3-y;0;x1-x];
B4 = [0;x1-x;y3-y];
B5 = [y-y2;0;x-x4];
B6 = [0;x-x4;y-y2];
B7 = [y1-y;0;x3-x];
B8 = [0;x3-x;y1-y];
B = [B1 B2 B3 B4 B5 B6 B7 B8];
D = (E/((1+v)*(1-2*v)))*[1-v v 0;v 1-v 0;0 0 0.5-v];
A = B.'*D*B
g = matlabFunction(A)
integral2(g,0,1,0,1)
I got this error.
Error using reshape
To RESHAPE the number of elements must not change.
Is there any possible way to convert symbolic function matrix to function handle in form of matrix? and how can i take integral of that matrix? otherwise i have to write every 64 equation seperately to take integral of them
1 Comment
Rik
on 19 May 2022
Regarding your flag ("It is my homework so and i don't think it will be helpful to answer common problems. I request it to be deleted. Best regards."): If you didn't want this question to be public you should not have posted. Now you have received an answer. It would be unkind to Catalytic to delete this thread. That is also why you no longer see delete button on your thread. Just in case you decide to edit away your question, I will make a copy here so it can be easily restored.
How to take double integral of a function matrix?
Hello!
I have a matrix that consist of 2 variables (x,y) functions and i have to take double integral of it.
clear
clc
syms x y
a=1; b=1; t=1;
E=100/72; v=0.2;
x1=0; x2=b; x3=b; x4=0;
y1=0; y2=0; y3=a; y4=a;
B1 = [y-y4;0;x-x2];
B2 = [0;x-x2;y-y4];
B3 = [y3-y;0;x1-x];
B4 = [0;x1-x;y3-y];
B5 = [y-y2;0;x-x4];
B6 = [0;x-x4;y-y2];
B7 = [y1-y;0;x3-x];
B8 = [0;x3-x;y1-y];
B = [B1 B2 B3 B4 B5 B6 B7 B8];
D = (E/((1+v)*(1-2*v)))*[1-v v 0;v 1-v 0;0 0 0.5-v];
A = B.'*D*B
g = matlabFunction(A)
integral2(g,0,1,0,1)
I got this error.
Error using reshape
To RESHAPE the number of elements must not change.
Is there any possible way to convert symbolic function matrix to function handle in form of matrix? and how can i take integral of that matrix? otherwise i have to write every 64 equation seperately to take integral of them
Answers (1)
Catalytic
on 19 May 2022
syms x y
a=1; b=1; t=1;
E=100/72; v=0.2;
x1=0; x2=b; x3=b; x4=0;
y1=0; y2=0; y3=a; y4=a;
B1 = [y-y4;0;x-x2];
B2 = [0;x-x2;y-y4];
B3 = [y3-y;0;x1-x];
B4 = [0;x1-x;y3-y];
B5 = [y-y2;0;x-x4];
B6 = [0;x-x4;y-y2];
B7 = [y1-y;0;x3-x];
B8 = [0;x3-x;y1-y];
B = [B1 B2 B3 B4 B5 B6 B7 B8];
D = (E/((1+v)*(1-2*v)))*[1-v v 0;v 1-v 0;0 0 0.5-v];
A = B.'*D*B;
g = matlabFunction(A);
in1=@(fun) integral(fun,0,1,'ArrayValued',1);
out=in1( @(x) in1( @(y)g(x,y) ) )
0 Comments
See Also
Categories
Find more on Numbers and Precision 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!