# Initial guessing to bvp4c MATLAB

I am working on a 4th order non-linear variable coefficient homogeneous ODE bvp. I am having issues getting a solution using bvp4c. This could be one of many things. Not having a solution within the boundaries I am providing, due to the non-linearity matlab cannot resolve to a solution, or the initial guesses for the functions are so far off it can't work with them. The error I am getting is

Error using bvp4c (line 251)
Unable to solve the collocation equations -- a singular Jacobian encountered.


I was wondering if there is a better way to provide initial guesses. I would like to give a vector of points that the solution should be near. Is that possible? Any other advice?

btw, I am unable to post example an example code.

• Check the boundary conditions, I frequently got errors because some index error there making a solution impossible. If you have any physical insight into the problem, you could guess a good initial point and use the IVP solution as initialization. – LutzL Jan 15 at 16:25
• at this link mathworks.com/help/matlab/ref/bvpinit.html it says for multiple point bvp, you can specify the point in [a,b] at which the boundary conditions apply, other than the endpoints a and b. Any idea on how to do this.?For my problem I have a y(a) = h, y'(a) = 0, y(b)=1, and y'(b) = 0. – tenichols Jan 15 at 21:21
• You can also impose conditions on more than 2 points in the framework of bvp4c. But I do not think that you need that. Depending on what you used in the initial approximation, the negative result can mean that there is no solution close to the straight line $y(t)=(t-a)/(b-a)$, any solution has a much more winded (or is that wended?) path, or that there is no solution at all. In general you will need more insight into the rough shape of the solution, like when designing the path of a space probe, you need to know what sling-by maneuvers are to be included. – LutzL Jan 15 at 21:43
• I have a good idea of what the solution should look like. If I was to divided the equation up into 3 sections [a b c], the a and c section will be constant but different values, at the b section the transition from a --> c will occur, I just want to know how it will occur. Any advice on how to impose conditions onto more than one point? – tenichols Jan 16 at 14:30
• You have no control on what the solution will finally look like. But if you can expect that to be the general shape, then setting the values in yinit in that way should be sufficient. If the results do not match the expectations, debug the code and if that is ok, then debug the theory that led to these expectations. – LutzL Jan 16 at 14:38