MATLAB: Solving 4th order ode

beamode

I try to solve the ODE shown on the figure. E and I are constants and q is a point Load in the middle of the beam i.e. at x=5. I want to obtain the settlement (=s) in function of x. The beam starts at x=0 and ends at x=10.
  • My first problem is to write the correct fuction for q. I used: q*heaviside(x-5)
  • The second problem is solving the ODE. I used : dsolve function. I have 4 Boundary conditions:
  1. The Moment is 0 at x=0
  2. The Moment is 0 at x=10
  3. The Shear force is 0 at x=0
  4. The Shear force is 0 at x=10
This is my code. Thanks in advance and keep in mind that i am a beginner in matlab.
EI=10;
k=4;
q=1;
x=0:0.1:10;
syms s(x);
Ds = diff(s);
D2s = diff(s,2);
D3s = diff(s,3);
dsolve(q*heaviside(x-5)==diff(s,4)*EI+k*s,D2s(0)*EI==0,D2s(10)*EI==0,D3s(0)*EI==0,D3s(10)*EI==0)

Best Answer

Mechanical engineering is nto my area of expertise, so I won’t comment with respect to your using heaviside correctly here.
You seem to have set it up correctly, but it’s not giving the output in the image you posted:
syms s(x);
EI=sym(10);
k=sym(4);
q=sym(1);
Ds = diff(s);
D2s = diff(s,2);
D3s = diff(s,3);
s = dsolve(q*heaviside(x-5)==diff(s,4)*EI+k*s,D2s(0)*EI==0,D2s(10)*EI==0,D3s(0)*EI==0,D3s(10)*EI==0);
s = simplify(s, 'steps',10)
figure(1)
subplot(4,1,1)
ezplot(imag(s), [0 10])
title('s(x)')
subplot(4,1,2)
ezplot(imag(diff(s)), [0 10])
title('\theta')
subplot(4,1,3)
ezplot(EI*imag(diff(s,2)), [0 10])
title('M')
subplot(4,1,4)
ezplot(EI*imag(diff(s,3)), [0 10])
title('T')
It simplifies to:
s =
- (sign(x - 5)*1i)/8 - 1i/8
You can take out the simplify call if you want, but it doesn’t significantly affect the results.