Euler's Method and Deflection of Cantilever Beam
78 views (last 30 days)
Show older comments
Hi, I'm trying to write the code to calculate the deflection of a beam using euler's method. The deflection of the beam is given as w/(24*EI)*(x^4-4Lx^3+6L^2x^2) and the derivative is w/(24*EI)*(4x^3-12Lx^2+12L^2x). This code works except the answers I am looking for are slightly off. So when x = 1.25, y = 3099, but right now I'm getting x = 2.5, y = 3099. Does anyone know why this is or can help me fix this?
w = 21819;
EI = 106;
L = 5; % length
h=1.25; % step's size
N=5; % number of steps
y(1)=1;
for n=1:N
y(n+1)= y(n)+h*(w/(24*EI))*(4*x(n).^3 - (12*L*x(n).^2) + (12*L^2*x(n)));
x(n+1)=n*h; % euler's method, using derivative of given function
end
plot(x,y)
0 Comments
Accepted Answer
Alan Stevens
on 15 Nov 2020
Your derivative is incorrect for your specified deflection equation. I think your deflection equation is also not quite right. Simple Euler is never going to give a good result here because of the rapid variation with x, even with a large number of steps. y(1) must be zero to be consistent with the deflection equation. Have a look at the following:
w = 21819;
EI = 106;
L = 5; % length
N = 100; % number of steps
h = L/N; % step's size
ytrue = @(x)w/(24*EI)*(x.^4 - 4*L*x.^3 + 6*L^2*x.^2); % uniformly loaded cantilever beam
y(1)=0;
x(1) = 0;
for n=1:N-1
y(n+1)= y(n)+h*w/(24*EI)*(4*x(n).^3 - 12*L*x(n)^.2 + 12*L^2*x(n));
x(n+1)=n*h; % euler's method, using derivative of given function
end
plot(x,ytrue(x),x,y,'.'),grid
xlabel('x'),ylabel('displacement')
legend('true','Euler')
8 Comments
Ryuxin
on 4 May 2022
Can we write this program which calculates the N segmenst of beam deflection without using the Euler's method?
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!