I am having a lot of trouble solving this boundary value problem?
3 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Boundary Value Problems についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!