

- estimate A & B diffusion at all bins with a discretized version of the diffusion equation
- react any A + B => S that are in the same bin, at all bins
- update A, B, S concentrations to reflect reactions at all bins


. In other words, row 1 elements are the concentrations at t=0, for various positions. Column 1 elements are the concentrations at x=0, for various times. Column 1 will be zero for the whole simulation, because the reactant reaching x=0 is immediately consumed. Row 1 is a row of constants (except for a 0 in column 1), beacuse we assume a uniform concentration in the slab at t=0. The rest of the rows are unknown. Compute row 2 by applying the discretized diffusion equation to row 1, and think about how you want to treat the edges. Repeat for successive rows, until done, i.e. until completing the final time step. Will it reach a steady state? Do the simulation to find out.Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!