I am having a lot of trouble solving this boundary value problem?

조회 수: 3 (최근 30일)
Robin
Robin 2011년 8월 8일
So Basically here is the problem:
I was given a second order function that models longitudinal displacements in a longitudinally loaded elastic bar.
a(x)*u''(x) + a'(x)*u'(x)=f(x), 0 <= x <=1
I know that the left end is at x=0 and the right end is at x=1. So that means:
u(0)=u(1)=0 (does not bend at the ends)
the first two parts of the problem asked me to use the symbolic solver and the numerical ode45 to solve the problem , which I was able to do. However the last part asked me to use bvp4c, I guess a special boundary value problem solver.
a(x)=(1+exp(x)) and f(x)= 5*sin(2*pi*x)^2
this is what I tried to do:
%--------------------------------------------------
rhs3= @(x,y) [y(2); -(exp(x)./(1+exp(x))).*y(2)+... ((5.*sin(2.*pi.*x).^2)./(1+exp(x)))];
figure
hold on
solinit= bvinit(0:0.2:1,[1 0]); % I knew that bvp4c requires a "pre-processor" and I think this is the initial guess but I am not sure if [1 0] should be it
bcond= @(ya, yb) [ya(1); yb(1)+.5570] %-- I am not sure what this line is supposed to do, but I think that its the boundary conditions? basically I know that u(0)=0 and u(1)=0, and the value -.557 is the value of the constant to u'(x) that will give a u(1)=0
bvsol=bvp4c(rhs3, bcond, solinit);
xx=0:.025:1;
yy=deval(bvsol,xx);
plot(xx,yy(1,:))
title('using boundary solver')
hold off
I get a graph but, I know it's wrong because its just starts at zero but exponentally decreases (u(1) does not = 0)
can someone please help me out? ?

답변 (0개)

카테고리

Help CenterFile Exchange에서 Boundary Value Problems에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by