BVP4C, differential equation for beam deflection

Hi fantastic MathWorks community.
I've been browsing and reading tons of material trying to understand how to implement BVP4C into my problem - but with no luck..
The guides that are available usually looks something like: y´´ + 2y = 0 - but my equation has a value that changes with x.
I want to plot the deflection w along the length x.
The boundary conditions are:
My M(x), E(x) and I(x) are vectors , example:
M = [50 40 30 20 10 0]
I = [1 1 1 2 2 2]
E = [190e9 190e9 100e9 100e9 100e9 100e9]
---------------
I started with converting it into a first order ODE:
This is what I wrote so far... I don't know where to go from here.
function dwdx = mybvp(x,w, M, E, I)
dwdx = [ w(2); M/(E*I)];
end
function res = mybvpbc(wl,wr)
res = [ wl(1); wr(2) ];
end
Thanks in advance!

4 Comments

Please supply the x-vector corresponding to the other vectors (M,I and E).
Hi Torsten.
The x-vector is the length of the beam, with each position corresponding to the value in M, E and I.
So to continue on the example I presented in the first post, x would be: x = [0 1 2 3 4 5] (meters).
Your data are contradictory.
On the one side, you want w'(0) = 0, on the other side (in your code), you want w'(L) = 0.
What is correct ?
It's a cantilever beam, so the only boundary conditions I have are w'(0) = 0 and w(0) = 0.

Sign in to comment.

Answers (1)

Torsten
Torsten on 3 Mar 2022
Edited: Torsten on 3 Mar 2022
This is the solution for w(0)=w'(0)=0:
M = [50 40 30 20 10 0];
I = [1 1 1 2 2 2];
E = [190e9 190e9 100e9 100e9 100e9 100e9];
A = [-1 0 1 0 0 0 0 0; ...
0 1 0 0 0 0 0 0 ; ...
1 -2 1 0 0 0 0 0; ...
0 1 -2 1 0 0 0 0; ...
0 0 1 -2 1 0 0 0; ...
0 0 0 1 -2 1 0 0; ...
0 0 0 0 1 -2 1 0; ...
0 0 0 0 0 1 -2 1];
b = [0 ; 0 ; (M./(I.*E)).'];
w = A\b;
w = w(2:7)
And this is the solution for w(0)=0, w'(L)=0:
M = [50 40 30 20 10 0];
I = [1 1 1 2 2 2];
E = [190e9 190e9 100e9 100e9 100e9 100e9];
A = [1 -2 1 0 0 0 0 ;...
0 1 0 0 0 0 0 ;...
0 1 -2 1 0 0 0 ;...
0 0 1 -2 1 0 0 ;...
0 0 0 1 -2 1 0 ;...
0 0 0 0 1 -2 1 ;...
0 0 0 0 0 1 -1];
b = [M(1)/(I(1)*E(1)) ; 0 ; (M(2:end-1)./(I(2:end-1).*E(2:end-1))).';0.5*M(end)/(I(end)*E(end))];
w = A\b;
w = w(2:7)
This is the best approximation for w you can get with your data.

3 Comments

Thank you! Could you please elaborta more on what the A-matrix is?
You didn't need to use a ODE-solver?
Have a nice sunday!
First you will have to tell us what the correct boundary condition is.
The usual discretization for
w''(x) = f(x)
is
(w(x(i+1))-2*w(x(i))+w(x(i-1)))/dx^2 = f(x(i))
In your case:
x(i) = i (i=0,...,5)
and
f(x(i)) = M(x(i))/(I(x(i))*E(x(i)))
So you get the equations (assuming w(0)=w'(0)=0)
(w(1)-w(-1))/2 = 0 %implements w'(0) = 0
w(0) = 0 %implements w(0) = 0
(w(1)-2*w(0)+w(-1))/1^2 = M(0)/(I(0)*E(0)) % implements w''(0) = M(0)/(I(0)*E(0))
(w(2)-2*w(1)+w(0))/1^2 = M(1)/(I(1)*E(1)) % implements w''(1) = M(1)/(I(1)*E(1))
(w(3)-2*w(2)+w(1))/1^2 = M(2)/(I(2)*E(2)) % implements w''(2) = M(2)/(I(2)*E(2))
(w(4)-2*w(3)+w(2))/1^2 = M(3)/(I(3)*E(3)) % implements w''(3) = M(3)/(I(3)*E(3))
(w(5)-2*w(4)+w(3))/1^2 = M(4)/(I(4)*E(4)) % implements w''(4) = M(4)/(I(4)*E(4))
(w(6)-2*w(5)+w(4))/1^2 = M(5)/(I(5)*E(5)) % implements w''(5) = M(5)/(I(5)*E(5))
If you write this in matrix form
A*w = b
with the unknowns
w(-1),w(0),w(1),w(2),w(3),w(4),w(5),w(6)
you get A and b.

Sign in to comment.

Asked:

Ed
on 3 Mar 2022

Edited:

on 7 Mar 2022

Community Treasure Hunt

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

Start Hunting!