This line below avoids error but that doesn't mean it does what it is intended to do.
M = (D/(1-D))*(1./( (2*Ron*D/(R*((1-D).^2)))+1+(RL/R)*(1./((1-D).^2)) ))
James Tursa's solution is also error-free (copied below) but produces totally different results. M2 = (D./(1-D)).*(1./( (2.*Ron.*D./(R.*((1-D).^2)))+1+(RL./R).*(1./((1-D).^2)) ))
isequal(M,M2)
This is why it's critical to understand what the equation is supposed to do. I haven't put much time into making sense of it so maybe James' version is the correct version or maybe neither answers are correct.
Best Answer