Hello Marcus,
I understand that you're encountering the "Singular Jacobian using bvp4c" error while attempting to solve a boundary value problem.
Upon inspecting the code, it appears that the issue arises when the function 'myode' is called with the value of 'r' being zero, as shown:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1631526/image.png)
This results in the computation of 'dy(2,1)' to be 'NaN' because it involves division of zero by zero, which leads to the error you're experiencing. To rectify this, you should either initialize 'r' with a non-zero value or adjust the formula used to compute 'dy(2,1)' to handle the case when 'r' is zero.
Hope this helps.