# Integration of elements of a matrix

4 views (last 30 days)
ABG on 2 Nov 2022
Edited: Torsten on 2 Nov 2022
Hi guys!
I am trying to integrate each element of a matrix, but I can not obtain the correct integral.
syms x x1 x2 x3 x4 x5 x6 F3w F4w F5w F3p F4p F5p
L2=60000;
L1=40000;
SECOND TRUSS
C1=[1 x3 x3.^2; 1 x4 x4.^2; 1 x5 x5.^2]
C1_=inv(C1)
N1=[1 x x^2]*C1_
u1=(simplify(N1))
pretty(u1)
B1=diff(u1,x)
pretty(B1)
E=30E3
A=pi*(3500^2-3000^2)
K1=B1'*A*E*B1*L2
pretty(K1)
x3=40000;
x4=70000;
x5=100000;
K1p=eval(K1)
fun = @(x) K1p;
K1pp=integral(fun,40000,100000)
In this case, matrix K1pp must be the integral value between 40000 and 100000 from matrix K1, which has been previously calculated. I have tried in many ways, but none of them have worked.
I don't know if you could help me.
Thanks!

Torsten on 2 Nov 2022
Edited: Torsten on 2 Nov 2022
syms x x1 x2 x3 x4 x5 x6 F3w F4w F5w F3p F4p F5p
assume([x x1 x2 x3 x4 x5 x6 F3w F4w F5w F3p F4p F5p],'real')
L2=60000;
L1=40000;
%SECOND TRUSS
C1=[1 x3 x3.^2; 1 x4 x4.^2; 1 x5 x5.^2];
C1_=inv(C1);
N1=[1 x x^2]*C1_;
u1=(simplify(N1));
%pretty(u1);
B1=diff(u1,x);
%pretty(B1);
E=30E3;
A=pi*(3500^2-3000^2);
K1=B1'*A*E*B1*L2;
%pretty(K1);
x3=40000;
x4=70000;
x5=100000;
K1p=eval(K1);
%fun = @(x) K1p;
fun = matlabFunction(K1p);
K1pp=integral(fun,40000,100000,'ArrayValued',1)
K1pp = 3×3
1.0e+12 * 0.7147 -0.8168 0.1021 -0.8168 1.6336 -0.8168 0.1021 -0.8168 0.7147

### Categories

Find more on Common Operations in Help Center and File Exchange

R2022b

### Community Treasure Hunt

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

Start Hunting!