Plot bending moment diagram based on provided formula
Ältere Kommentare anzeigen
Hi, I have 2 questions regarding this. I already have equations (I upload it as a picture below please check it out) but apparently I am making mistakes on applying them cause the result are quite different than my expectation.( I guess i am making mistakes based on L and L_span) Could you please tell me what part of my code is wrong ? I am about to upload the equation . And my second question is aside from making mistakes in formula I can not plot it with non-integer steps . Means id i put x=1:0.5:14 then M(1.5) make an error so I gotta stick with only 14 valid integer in my preferred domain.thanks!

<<
x=input('Enter your preferred span : ') q=25; p=400;
if (x>=0 && x<=4)
L=4;
mu=(q*L*x/2)-(q*x*x/2);
mleft=-69.14;
mright=-238.27;
M=mu+(mleft*(4-x)/4)+(mright*x/4)
elseif (x>4 && x<7)
L=6;
mu=p*x/4;
mleft=-238;
mright=-218;
M=mu+(mleft*(L-x)/L)+(mright*x/L)
elseif (x>=7 && x<10)
L=6;
mu=p*(L-x)/4;
mleft=-238.27;
mright=-218.52;
M=mu+(mleft*(L-x)/L)+(mright*x/L)
elseif (x>=10 && x<=14)
L=4;
mu=(q*L*x/2)-(q*x*x/2);
mleft=-218.52;
mright=0;
M=mu+(mleft*(L-x)/L)+(mright*x/L)
else
disp('Warning! your span is over than the length of the beam')
end
%%Plot Bending Diagram
q=25;
p=400;
for x=1:14
if (x>=0 && x<=4)
L=4;
mu=(q*L*x/2)-(q*x*x/2);
mleft=-69.14;
mright=-238.27;
M(x)=mu+(mleft*(4-x)/4)+(mright*x/4);
elseif (x>4 && x<7)
L=6;
mu=p*x/4;
mleft=-238;
mright=-218;
M(x)=mu+(mleft*(L-x)/L)+(mright*x/L);
elseif (x>=7 && x<10)
L=6;
mu=p*(L-x)/4;
mleft=-238.27;
mright=-218.52;
M(x)=mu+(mleft*(L-x)/L)+(mright*x/L);
elseif (x>=10 && x<=14)
L=4;
mu=(q*L*x/2)-(q*x*x/2);
mleft=-218.52;
mright=0;
M(x)=mu+(mleft*(L-x)/L)+(mright*x/L);
end
end
x=1:14; plot(x,M,'rs-','MarkerSize',3,'MarkerFaceColor','m') grid on xlabel('x (m)') ylabel('M (kN.m)') title('Bending moment diagram')
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Mathematics finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!