Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
5 views

BVP Programming

This document defines functions to solve a boundary value problem (BVP) and plot the results. It defines material properties and discretization, solves the BVP using bvp4c to find displacements (u, w) and stresses (tau, sigma), interpolates the results over a grid, and plots the surfaces. It also defines the functions fun_def and fun_bc that specify the nonlinear BVP and boundary conditions.

Uploaded by

Ritesh Kumar
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

BVP Programming

This document defines functions to solve a boundary value problem (BVP) and plot the results. It defines material properties and discretization, solves the BVP using bvp4c to find displacements (u, w) and stresses (tau, sigma), interpolates the results over a grid, and plots the surfaces. It also defines the functions fun_def and fun_bc that specify the nonlinear BVP and boundary conditions.

Uploaded by

Ritesh Kumar
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

function result = BVP_tut2surf()

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)
result = [z; u];
%Functions----------------------------------------------------------------%-----------------------------------------------------------------------%-------------------------------------------------------------------------% Function - 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