This will probably be a glaring issue that I am missing. If I am trying to integrate from 0 to 0.115 why is my index coming back 0? Code is included below. I do not claim to be very good with MATLAB yet, either.

Solver:

`function dydx = finPFR(x,y)global beta gammadydx = zeros(2,1);c = y(1);T = y(2);dydx(1) = -c*exp(gamma(1-(1/T)));dydx(2) = c*beta*exp(gamma(1-(1/T)));end`

And the driver program:

`global beta gammabeta = 0.15;gamma = 30;xstep = [0:0.001:0.115];yzero = [1 1];[myx,myy] = ode45(@finPFR,xstep,yzero);subplot(2,1,1)plot(myx,myy(:,1,'k--'))xlabel('VR/Q')ylabel('Conversion')subplot(2,1,2)plot(myx,myy(:,2,'k-'))xlabel('VR/Q')ylabel('Temperature')`

Errors:

`>> run_finPFRAttempted to access gamma(0); index must be a positive integer orlogical.Error in finPFR (line 6)dydx(1) = -c*exp(gamma(1-(1/T)));Error in odearguments (line 87)f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.`

Error in ode45 (line 113)[neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs,odeFcn, ...Error in run_finPFR (line 6)[myx,myy] = ode45(@finPFR,xstep,yzero);

I know it's a long shot, but I have spent hours on this and can't seem to figure out where I am going wrong with the index. Any help would be appreciated!

## Best Answer