Solution to nonlinear differential equation
2 views (last 30 days)
Hello, I am trying to solve the following differential equation, but I am running into some issues when using ODE45:
subject to the boundary conditions:
I broke this up into a system of two first order differential equations, but I am having trouble with the following aspects of the problem:
- How do you input initial conditions which are both given in terms of just the function (i.e. not it's derivatives)?
- ODE45 will not be able to go too far past |t|=10, so should I just set my bc's at this point?
Any help would be greatly appreciated or a indication of the correct direction for solution. Thanks in advance!
darova on 30 Oct 2019
Here is an attempt
solinit = bvpinit([-1 1],[0 0]); %[-inf, inf] replaces with [-1, 1]
sol = bvp4c(@myode,@mybc,solinit);
plot(sol.x, sol.y), grid on
function dy = myode(t,y)
dy(1,1) = y(2);
dy(2,1) = 1/2*(1-exp(2*t))*sin(y(1));
function res = mybc(ya,yb)
res = [ya(1)