Is it possible to solve an ODE with boundary condition using a matlab solver?

1 view (last 30 days)
My question is very simple: I want to plot a graphic for the deflection of a beam, with consists of a solution of an ODE using a Matlab solver, such as:
%Call Solver -> Linear
[x y] = ode45(@MyFunctionL,xspan, x0);
x0 = [0 0];
xspan = [0 Lg];
function dy = MyFunctionL(x,y)
global Fg Lg EI;
dy = zeros(2,1);
dy(1) = y(2);
dy(2) = (Fg/EI)*(Lg - x);
return
It works perfectly at first, but in another case in which I have to set a condition such as y´(Lg/2)=0 I am having some trouble. It should result in a sort of Parabolic y(x) if I could "insert" this boundary condition.
I wish to know if I can do it using a MATLAB solver or only with bvp4c. (I am interested in doing with a solver because later I have to compare the linear solution with a non linear solution)
Thanks very much!

Accepted Answer

Mischa Kim
Mischa Kim on 19 Apr 2014
Daniel, what the various ode solvers are for ordinary differential equations, is bvp4c (and bvp5c) for boundary value problems. Since you are trying to solve a problem of the latter category you definitely want to go with either of the bvp solvers.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!