There seems to be an issue with the way you implemented the ODE function. The initial conditions are
and when you call ode45 with these initial conditions, then in first time-step the value in ode45 functions are defined like this
R=1.8e-8;
Pg=5.6*10^6;
..
..
..
Putting these values and other constants defined in your function into this term
((Pg0-Pg)^2/(Pg*R^3-Pg0*R0^3))
will result in a 0/0 condition, which creates NaN. You need to check if the ODE equations are correctly implemented in MATLAB.
Best Answer