フィルターのクリア

Help with a script that calculates bending moment of cantilever beam.

16 ビュー (過去 30 日間)
Tadas Grauzinis
Tadas Grauzinis 2020 年 4 月 21 日
回答済み: Nathan Hardenberg 2023 年 5 月 25 日
I have an array
ssmat= [ 10 9 7 6 3 2 1 0;
0 20 5 0 0 15 10 0;
0 10 0 0 15 0 0 0;
10 0 10 10 10 0 0 0]
ssmatl=logical(ssmat)
ssmatl=[ 1 1 1 1 1 1 1 0;
0 1 1 0 0 1 1 0;
0 1 0 0 1 0 0 0;
1 0 1 1 1 0 0 0]
First row of ssmat tells the distance from origin. And the fourth row, which is currently being worked with, tells the size of evenly distibuted load.
For example: Looking from lefto to right, since ssmat(4,1)~=0 it means that ssmat(1,1) is the point where the load starts and the closest nonzero value in fourth row is where it ends(ssmat(4,3)), the actual value is the magnitude of the load (10). In this case there are two evenly distributed loads from ssmat(4,1) to ssmat(4,3) and from ssmat(4,4) to ssmat(4,5).
I am trying calculate the bending moment induced by these forces in different parts of the beam. In this case thera are 14 points( Pp=14), Pp=2*(length(ssmat)-2).
The points are positioned like this:
The bending moment in point P is calculated like this:
M=magnitude of the force* l*(l/2+d)
In the point P where there are multiple loads:
M=magnitude of the force1* l1*(l1/2+d1)+magnitude of the force2* l2*(l2/2+d2).
If the point P was in betwen the beggining and the end of the load:
M=magnitude of the force1* l1*(l1/2)+magnitude of the force2* l2*(l2/2+d2).
I managed to write a script that works till the fifth point after that it gets trickier and currently just falls apart. I guess I could somehow apply the same principle for further points, but I am hoping that someone could help me out with a better solution.
I hope I managed to explain the situation clearly.
if Pp==14
for i=1
if sum(ssmatl(4,1:2))==0
mg1=0;
mg2=0;
mg3=0;
elseif sum(ssmatl(4,1:2))==1 && ssmat(4,i)==0
mg1=0;
mg2=0;
mg3=mg2;
elseif sum(ssmatl(4,1:2))==1 && ssmat(4,i)~=0
mg1=0;
mg2=ssmat(4,1)*abs(ssmat(1,2)-ssmat(1,1))*abs((ssmat(1,2)-ssmat(1,1))/2);
mg3=mg2;
elseif sum(ssmatl(4,1:2))==2
mg1=0;
mg2=ssmat(4,1)*abs(ssmat(1,2)-ssmat(1,1))*abs((ssmat(1,2)-ssmat(1,1))/2);
mg3=mg2;
end
end
for i=3:-1:1
for j=2:-1:1
if sum(ssmatl(4,1:3))==0
mg4=0;
mg5=0;
elseif sum(ssmatl(4,1:3))==1 && ssmat(4,i)~=0
mg4=ssmat(4,i)*abs(ssmat(1,3)-ssmat(1,i))*abs((ssmat(1,3)-ssmat(1,i))/2);
mg5=mg4;
elseif sum(ssmatl(4,1:3))==2 && ssmat(4,i)==ssmat(4,j) && i~=j
mg4=ssmat(4,i)*abs(ssmat(1,i)-ssmat(1,j))*abs(((ssmat(1,i)-ssmat(1,j))/2)+(ssmat(1,3)-ssmat(1,i)))
mg5=mg4;
elseif sum(ssmatl(4,1:3))==3
mg4=ssmat(4,1)*abs(ssmat(1,2)-ssmat(1,1))*abs(((ssmat(1,2)-ssmat(1,1))/2)+(ssmat(1,3)-ssmat(1,2)));
mg5=mg4;
end
end
end
for i=4:-1:1
for j=3:-1:1
for k=2:-1:1
if sum(ssmatl(4,1:4))==0
mg6=0;
mg7=mg6;
elseif sum(ssmatl(4,1:4))==1 && ssmat(4,i)~=0
mg6=ssmat(4,i)*abs(ssmat(1,4)-ssmat(1,i))*abs((ssmat(1,4)-ssmat(1,i))/2);
mg7=mg6;
elseif sum(ssmatl(4,1:4))==2 && ssmat(4,i)==ssmat(4,j) && i~=j
mg6=ssmat(4,i)*abs(ssmat(1,i)-ssmat(1,j))*abs(((ssmat(1,i)-ssmat(1,j))/2)+(ssmat(1,4)-ssmat(1,i)));
mg7=mg6;
elseif sum(ssmatl(4,1:4))==3 && ssmat(4,4)==0
mg6=(ssmat(4,1)*abs(ssmat(1,2)-ssmat(1,1))*abs(((ssmat(1,2)-ssmat(1,1))/2)+(ssmat(1,4)-ssmat(1,2))))+(ssmat(4,3)*abs(ssmat(1,4)-ssmat(1,3))*abs(((ssmat(1,4)-ssmat(1,3))/2)));
mg7=mg6;
elseif sum(ssmatl(4,1:4))==3 && ssmat(4,j)==ssmat(4,k) && j~=k
mg6=ssmat(4,j)*abs(ssmat(1,j)-ssmat(1,k))*abs(((ssmat(1,j)-ssmat(1,k))/2)+(ssmat(1,4)-ssmat(1,j)));
mg7=mg6;
end
end
end
end
for i=5:-1:1
for j=4:-1:1
for k=1:4
for l=2:-1:1
if sum(ssmatl(4,1:5))==0
mg8=0;
mg9=mg8;
elseif sum(ssmatl(4,1:5))==1 && ssmat(4,i)~=0
mg8=ssmat(4,i)*abs(ssmat(1,5)-ssmat(1,i))*abs((ssmat(1,5)-ssmat(1,i))/2);
mg9=mg8;
elseif sum(ssmatl(4,1:5))==2 && ssmat(4,i)==ssmat(4,j) && i~=j
mg8=ssmat(4,i)*abs(ssmat(1,i)-ssmat(1,j))*abs(((ssmat(1,i)-ssmat(1,j))/2)+(ssmat(1,4)-ssmat(1,i)));
mg9=mg8;
elseif sum(ssmatl(4,1:5))==3 && ssmat(4,
mg8=(ssmat(4,1)*abs(ssmat(1,2)-ssmat(1,1))*abs(((ssmat(1,2)-ssmat(1,1))/2)+(ssmat(1,4)-ssmat(1,2))))+(ssmat(4,3)*abs(ssmat(1,4)-ssmat(1,3))*abs(((ssmat(1,4)-ssmat(1,3))/2)));
mg9=mg8;
elseif sum(ssmatl(4,1:4))==3 && ssmat(4,j)==ssmat(4,k) && j~=k
mg8=ssmat(4,j)*abs(ssmat(1,j)-ssmat(1,k))*abs(((ssmat(1,j)-ssmat(1,k))/2)+(ssmat(1,4)-ssmat(1,j)));
mg9=mg8;

回答 (2 件)

darova
darova 2020 年 4 月 22 日
I think you are overcomplicated. Look on this idea
  1 件のコメント
darova
darova 2020 年 4 月 22 日
Distributed load can be discretized of course

サインインしてコメントする。


Nathan Hardenberg
Nathan Hardenberg 2023 年 5 月 25 日
I think writing a script to solve only this exact beam setup is not really to usefull. The aproach of dividing the beam into appropriate sections is really useful in a calculation by hand, but very costly when programming. I think it is easier to choose small incements and calculate for every increment.
I found a somewhat similar question, which I answerd there. But there it is more general:
For distributed loads it might be easier, to calculate the shear-forces at first. And then integrate this to get the bending moment.

カテゴリ

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

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by