Boundary conditions in ode

조회 수: 1 (최근 30일)
Fatemeh
Fatemeh 2023년 4월 23일
편집: Torsten 2023년 4월 23일
Hello, I have a question. It would be greatly appreciated if someone could help me out. How can I define these boundary conditions in the following code ? y'(80)=0 and y(C0)=t0.
syms y(x) x Y
N=5;
r=0.05;
m=0.01;
p=1;
s=1;
t=0.1;
a=0.25;
b=0.25;
C0=1;
C=5;
f=(x+((x^2)+4*r*x*(1-a-b))^0.5)/(2*(1-a-b));
%t1=-(N+r+t*p*s-m);
Dy = diff(y);
D2y = diff(y,2);
t0= (((1-a)/a)*(1/r)^((a+b)/(1-a-b));
ode = y-(((1-a)/a)*(1/(r+f))^((a+b)/(1-a-b))+Dy*(C-x-m-(s^2))+0.5*D2y*(x^2)*(s^2)-(s^2)*x*Dy)/(r-m);
[VF,Subs] = odeToVectorField(ode);
odefcn = matlabFunction(VF, 'Vars',{x,Y});
tspan = [C0 C];
ic = [t0 0];
[x1,y1] = ode45(odefcn, tspan, ic);
figure
plot(x1,y1(:,1), 'DisplayName','(x_1,y_1_1)')
  댓글 수: 6
Fatemeh
Fatemeh 2023년 4월 23일
Thanks and what does yb(2) mean?
Torsten
Torsten 2023년 4월 23일
편집: Torsten 2023년 4월 23일
It means that the second function you want to solve for (i.e. y') in the right boundary point (b) (i.e. x = 80) should be 0.
And ya(1) - t0 means that the first function you want to solve for (i.e. y) in the left boundary point (a) (i.e. x = C0) should be t0.
Here are examples to study on how to use bvp4c:

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by