Yes, that is what I want to solve; however, the case you're referring to is I believe the trivial case; we have already solved for when k = 0, and got a non-trivial solution. As K is small, this will be close to it and there will be non zero solutions.
On Tuesday, April 9, 2013 12:35:08 PM UTC+1, Torsten wrote: > D R G <email@example.com> wrote in message <firstname.lastname@example.org>... > > > I'm quite new to ODE45, and have a form of an equation I wish to solve with some unusual features - C is a function of r. I want to evaluate it on the interval [RN RO] where RN is not equal to zero. It is a second order equation and I have reduced it into a series of first order equations so ODE45 can handle it. The X vector for these equations is > > > > > > > > > X(1) = C > > > X(2) = Z = C' > > > > > > > > > Now, I can convert this to two order ODES. In this case, J, H and K are known constants and I get..... > > > > > > dX(1) = X(2) > > > > > > dX(2) = (J*X(1) - (2/r)*(X(1) + K)*X(2))/(X(1) + K) > > > > > > I know also that > > > > > > C(RN) = 0 so then X(1) @ RN = 0 > > > Z(RN) = 0 so then X(2) @ RN = 0 > > > > > > However, I'm confused about how to implement this for 2 reasons; (1) my equation dX(2) has an r term in it, which C is a function of; how do I make MATLAB recognise this? > > > > > > and (2) My initial conditions (or in this case, an analog of initial conditions as r refers to radius rather than time) are not zero; all values of C from 0 to RN are already zero, and I want to evaluate the function between the limits [RN RO]. > > > > > > Does anyone know if this is possible, and how one would implement this? I'd be most grateful for answers, as my knowledge is limited here and it seems an unusual form so I can't find examples to work with... > > > > > > DRG > > > > From what you write above, I'd deduce that you want to solve > > 1/r^2 d/dr(r^2*dy/dr) = J*y/(y+K) > > with boundary condition > > y(RN)=dy/dr(RN)=0. > > If this is the case, it's easy: solution is y=0 on all of [RN RO] - no need to use ODE45. > > > > Best wishes > > Torsten.