Like the one on this Wikipedia page, all of the diagrams I've seen so far seem to show a rectangular graph of charge density at a PN junction. I'd like to understand why.
I tried to simulate a process where I iteratively diffused the free charge carriers, and then recombined the overlapping charge densities of positive and negative carriers. While I do get a sharp transition in the middle, I don't get the sharp transitions at the edges of the depletion region. My idea is that I've incorrectly modeled diffusion, as I've just used a double moving average filter.
I'm attaching the generated graphs, where each row represents a step (either diffusion or recombination), while the columns represent (from left to right) static charge, the charge of free carriers and total charge.
What am I doing wrong?