MATLAB: How do you create a loop to find a coefficient value to which one of the variables in the function changes with every cycle

For example:
The change in weight (dW) of an aircraft due to fuel consumption is shown below:
dW=(-SFC/N)*sqrt((2*W^3)/(p*S))*(1/((Cl^1.5)/Cd))*dt
With 'W' being the total weight of the aircraft and current fuel load, 'dt' being the change in time of the aircraft and the rest of the coefficients being constant. For a given time period of 100,000 seconds, how would the loop be generated? As the 'W' variable would change with every cycle, resulting in a different dW in every cycle ad so on. I believe the following should be involved but I'm not sure how, any help would be greatly appreciated.
dt=0:100:100000
W=W+dW
dW=(-SFC/N)*sqrt((2*W^3)/(p*S))*(1/((Cl^1.5)/Cd))*dt
Thanks alot James

Best Answer

The first thing to be clear about is the distinction between the time step, dt, and the time itself, which might be called t. dt is the change in time between successive values of t.
You probably want dt to be constant, but t will change. So your loop might look something like this:
t_start = 0;
t_end = 100000;
dt = 100; % time step
for t = t_start : dt : t_end
% compute dW and update W here
end
Related Question