Stress and deflection Equation Not Working Out

8 views (last 30 days)
I hvae to write a code to calculate stress and deflection along the beam at intervals of 10cm, i hvae tried the equation multiple ways and its not working could someone please show me where i'm going wrong.
Values-
E is the modulus of elasticity and I is the moment of inertia.
Assume that the cantilever beam is 2 metres long with a 2,000N load located 1 metre from the end.
The beam has:
Section modulus (Z) of 1.5x105mm3 Moment of inertia (I) of 44.6 x l06 mm4 and Modulus of elasticity (E) of 2 x l05 N/mm2 .
E = 2*10^5;
P = 2000;
I = 44.6*10^6;
l = 2;
a = (0:0.1:l);
b = (l-a);
for n = 1:length(a)
s(1:4,n) =(P*a(n)*b(n).*c)./(I*l);
end
%plot(a,s)
for x = 1:length(a)/2
for d = 1:4
d = ((P.*b(x).*x)./(6*l*E*I)).*(l.^2-x.^2-b(x).^2);
end
end
for x = length(a)-1
for d2 = 1:4
for mi = I(1:4)
d2 = -(((P*b)./(6*l*E*mi)).*((l./b).*(x-a).^3)+(l^2-b.^2).*(x-x^3));
end
figure
plot(d2)
end
end

Answers (1)

Jon
Jon on 2 Nov 2021
You may have other issues, but to start with you have to assign the value of the variable c before you use it at line 8
  3 Comments
Jon
Jon on 2 Nov 2021
However you want to find a value for c, you need to assign it before you can use it on the right hand side of an expression.
So you need to have a line such as:
c = 2
before you get to
s(1:4,n) =(P*a(n)*b(n).*c)./(I*l);
Jon
Jon on 2 Nov 2021
Also, your line of code
for mi = I(1:4)
does not make sense, as you only have assigned one value to I (I = 44.6*10^6;). So it doesn't make sense to loop through 4 values of I when there is only one value for it

Sign in to comment.

Categories

Find more on Stress and Strain in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

Start Hunting!