So I'm fairly new to matlab (meaning I did the tutorials, but aside from that I'm what you would call a noob).
I do have a fairly complicated issue: I have a PDE-BVP, which I wanna solve as an ODE-BVP in form of a loop over a bvp4c routine. So basically I have a 2D-Mesh (x and y) and I wanna solve the BVP in y direction in a loop for every x-increment.
The first and most representative part of my problem (where I'm already running into issues) has the following form: where
With the starting BVP's:
f(0)=0 (this should change later on to the value of f(i-1))
Then I substituted the d()/dx to the finite differences formulation ()(i)-()(i-1)/deltaX, since I just want functions in the form of f(y).
The error I get right now is that the indices should be real and positiv. Which comes from my finite difference formulation for the first step. So I just tried to start the loop from i=2, however then the system has the wrong dimensions.
So I'm on the fence about my formulation.
Is there a better way to go about my problem?
Any help would be greatly appreciated!! This problem really stops me in my tracks and is haunting my for quite some time now. I already tried finite-differences together with fsolve (but that is waaaaaay to slow). I know it's solvable since I solved it with Mathematica, but for reasons I will not go into here I failed to get a useful solution later on in my model: thus Matlab ;) for better handling of the numeric issue.
Thanks in advance!!
My code sofar goes as:
infinity = 10;
solinit = bvpinit(linspace(0,infinity,N),[f0 g0 h0]);
options = bvpset('stats','on');
sol = bvp4c(@(eta,f)LRode(eta,f,N,i,deltaX),@(f0,finf)LRbc(f0,finf,i)...
eta = sol.x;
f = sol.y;
function dfdeta = LRode(eta,f,N,i,deltaX)
dfdeta = [ f(2,i)
-f(1,i)*f(3,i) - 2*(i/N)*(f(3,i)*((f(1,i)-f(1,i-1))/deltaX)-...
function res = LRbc(f0,finf,i)
res = [f0(1,i)
f0(2,i) - 1