Watch this Author's files
Bug 1: D=D(D<r2); vcc=vc(D<r2); should be vcc=vc(D<r2);D=D(D<r2);
Bug 2: Division by zero when a component in D is zero, and e is negative.
Contact us at files@mathworks.com