Euler's Method and Deflection of Cantilever Beam
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)
Accepted Answer
More Answers (0)
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!