MATLAB: My code is stuck on “Busy”; I’m using ode45 and functions for the first time.

MATLABode45

I'm trying to solve a system of equations, and this is my first time using functions or ode45. I have not been able to successfully run my code without it being perpetually "Busy". I've tried pausing and stepping through the lines, but I'm guessing it is getting trapped in ode 45. I'd greatly appreciate any insight or tips on utilizing this better.
%Variables
G = 6.67*10^-11; %km^3/(kg*s^2)

M = 8; %kg


T = .0121; %N

mdot = 8.0*10^-7; %kg/s
%Initial Conditions
r0 = 19178; rdot0 = 0;
theta0 = 0; thetadot0 = sqrt((G*M)/r0^3);
IC = [r0, rdot0, theta0, thetadot0];
%call ode45 solver
[t, state_values] = ode45(@f,[0 2600000],IC);
r = state_values(:,1);
figure(1)
plot(t,r)
xlabel('Time');
ylabel('Altitude');
function sdot = f(t,state_values)
%state variables
r = state_values(1); %store radius value from previous time step
rdot = state_values(2);
theta = state_values(3);
thetadot = state_values(4);
%parameters
G = 6.67*10^-11; %km^3/(kg*s^2)
M = 8; %kg
T = .0121; %N
mdot = 8.0*10^-7; %kg
d2rdt2 = r*thetadot^2 - (G*M)/r^2;
d2thetad2 = (T/(M/(mdot*t))) - 2*rdot*thetadot;
sdot = [rdot d2rdt2 thetadot d2thetad2]'; %store as a column vector
end

Best Answer

Looking at the coefficients, your system is ‘stiff’. Use ode15s (or one of the other stiff solvers) instead. The code is otherwise the same.