solving 4th order ode
19 次查看(过去 30 天)
显示 更早的评论
Hello everyone! I would appreciate your help in this section.
I have this 4th order,non-linear ,homogeneous ode that I would like to solve:
(2B+1+y)y''-k(1+y)y''''=0 with: y(0)=y(L)=0;y'(0)=y'(L)=1; where B,k and L are constants.
This is my matlab code so far:
L=1;B=0.25;k=0.1;
dydt = zeros(4,1);
dydt(1)=y(2);
dydt(2)=y(3);
dydt(3)=y(4);
dydt(4)=((2.*B+1+y(1)).*y(3))./(k.*(1+y(1)));
y1(1)=0; y1(end)=0; y2(1)=1; y2(end)=1;yint=[y1(1);y1(end);y2(1);y2(end)];
tspan = [0 1];
[t,y] = ode45(@(t,y) dydt, tspan, yint);
plot(t,y,'-o')
I think that something is not right. I have almost no expericance with solving ode's with MATLAB, especially with this high order so basically I gathered pieces of codes from things I saw online with the hope that it will assemble to a reasonable solution. I'm not sure I'm in a good path at all. I would be grateful for some guidance. Roi
0 个评论
采纳的回答
darova
2019-10-1
Use bvp4c()
You already have written your equation as system of first-order equations
function dydt = ode4(t,y)
L=1;B=0.25;k=0.1;
dydt = zeros(4,1);
dydt(1)=y(2);
dydt(2)=y(3);
dydt(3)=y(4);
dydt(4)=(2.*B+1+y(1)).*y(3))./(k.*(1+y(1));
end
Here is function for your boundary conditions
function res = bc4(y0, y1)
res = [y0(1)-0 % y(0) = 0
y0(2)-1 % y'(0) = 1
y1(1)-0 % y(end) = 0
y1(2)-1]; % y'(end) = 1
end
See bvp4c
21 个评论
darova
2019-11-19
I tried this
x=0.5;
x1=fsolve(@solver,x);
And set limits for y axis:
ylim([0 2])
THe result (y'(0)=y'(1)=0.):

更多回答(1 个)
Roi Bar-On
2019-11-7
1 个评论
Elayarani M
2020-9-23
Hi. I want to solve the following equation using ode45 solver.
How to set the initial conditions?
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Ordinary Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

