0% found this document useful (0 votes)
44 views1 page

BVP

This document defines functions to solve a boundary value problem (BVP) for a beam. It defines global constants, initializes boundary conditions, calls the bvp4c solver, and plots the resulting solutions for displacement, slope, shear stress and normal stress along the beam.

Uploaded by

Ritesh Kumar
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views1 page

BVP

This document defines functions to solve a boundary value problem (BVP) for a beam. It defines global constants, initializes boundary conditions, calls the bvp4c solver, and plots the resulting solutions for displacement, slope, shear stress and normal stress along the beam.

Uploaded by

Ritesh Kumar
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

function result = BVP()

global nu
global l
global E
nu=0.3;l=5000;E=2.1e5;
z = linspace(0,500,101);x=0:10:5000;
initial_guess = bvpinit(linspace(0,500,101),[0 0 0 0 ]);
solution_bvp4c = bvp4c(@fun_def, @fun_bc, initial_guess);
solution = deval(solution_bvp4c, z);
u=solution(1,:);
w=solution(2,:);
tau=solution(3,:);
sigma = solution(4, :);
for i=1:101
for j=1:501
U(i,j)=u(i)*cos(pi.*x(j)/5000);
W(i,j)=w(i)*sin(pi.*x(j)/5000);
TAU(i,j)=tau(i)*cos(pi.*x(j)/5000);
SIGMA(i,j)=sigma(i)*sin(pi.*x(j)/5000);
end

end
surf(x,z,U)
surf(x,z,W)
surf(x,z,TAU)
surf(x,z,SIGMA)
% Function for the nonlinear problem------function dudz = fun_def(z, u)
dudz = [
(-pi/l*u(2))+((2*(1+nu)/E)*u(3))
(nu*pi/l*u(1))+(((1-nu)/E)*u(4))
((E*pi^2/l^2)*u(1))-((nu*pi/l)*u(4))
((pi/l)*u(3))
];
end
% Function - Boundary condition-------function bc = fun_bc(u0, u1)
bc = [ u0(3)
u1(3)
u0(4)
u1(4)+5];
end
end

You might also like