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