Page 142 -
P. 142

the diode for a source potential that is a function of time, we need to repeat
                             the Newton-Raphson iteration for each of the different source voltage val-
                             ues at the different times. The sequence of the computation would proceed
                             as follows:

                                1. Generate the time array.
                                2. Generate the source potential for the different elements in the time
                                   array.
                                3. For each time array entry, find the potential across the diode using
                                   the Newton-Raphson method.
                                4. Obtain the current array from the potential array.
                                5. Plot the source potential and the current arrays as a function of the
                                   time array.

                              Assuming that the source potential is given by:

                                                       V  = V  sin(2πft)                   (5.18)
                                                        s
                                                             0
                             and that f = 60 Hz, V  = 5 V, kT = 0.025 V, R = 500 Ω, and the saturation current
                                              0
                             I is 10  mA; the following script M-file finds the current in this circuit:
                                  –6
                             s
                                Is=10^(-9);
                                R=500;
                                kT=1/40;
                                f=60;
                                V0=5;
                                t=linspace(0,2/f,600);
                                L=length(t);
                                K=200;
                                Vs=(V0*sin(2*pi*t*f))'*ones(1,K);
                                v=zeros(L,K);
                                i=zeros(L,K);

                                   for k=1:K-1
                                   v(:,k+1)=v(:,k)-(Is*(exp((1/kT)*v(:,k))-1)-...
                                     (1/R)*(Vs(:,k)-v(:,k)))./...
                                     ((1/kT)*Is*exp((1/kT)*v(:,k))+1/R);
                                   i(:,k+1)=(Vs(:,k+1)-v(:,k+1))/R;
                                   end

                                plot(t,1000*i(:,K),'b',t,Vs(:,K),'g')


                             © 2001 by CRC Press LLC
   137   138   139   140   141   142   143   144   145   146   147