Compensating porosity gradient to produce flat, micromachined porous silicon structures