I cried victory too soon :D.
I get this error on the second cycle:
>> syms x
>> total = 0;
>> t=0;
>> t2 = 0;
>> p = 4.8825*exp(-0.0954*t)+ 12.845*exp(-0.0006211*t);
>> for i=1:159
t2 = double(solve(4.8825*exp(-0.0954*t)+ 12.845*exp(-0.0006211*t)-p,'t'));
p = double(4.8825*exp(-0.0954*(t2+4.77))+ 12.845*exp(-0.0006211*(t2+4.77)) + 0.05262*4.4253);
total = total + double(int(4.8825*(exp(-0.0954*x)+12.845/4.8825*exp(-0.0006211*x)),x,t2,t2+4.6059));
end
??? Error using ==> solve>getEqns at 178
' 1.590127e+000 ' is not a valid expression or equation.
Error in ==> solve at 67
[eqns,vars] = getEqns(varargin{:});
How do I use sprintf then in this case?