Page 264 - Solutions Manual to accompany Electric Machinery Fundamentals
P. 264

i_a = 0:1:55;
                 for jj = 1:length(i_a)

                    % Get the voltage difference
                    diff = Ea - Vt - i_a(jj)*r_a;

                    % This code prevents us from reporting the first (unstable)
                    % location satisfying the criterion.
                    was_pos = 0;
                    for ii = 1:length(i_f);
                       if diff(ii) > 0
                          was_pos = 1;
                       end
                       if ( diff(ii) < 0 & was_pos == 1 )
                          break;
                       end;
                    end;

                    % Save terminal voltage at this point
                    v_t(jj) = Vt(ii);
                    i_l(jj) = i_a(jj) - v_t(jj) / ( r_f + r_adj);

                 end;

                 % Plot the terminal characteristic
                 figure(1);
                 plot(i_l,v_t,'b-','LineWidth',2.0);
                 xlabel('\bf\itI_{L} \rm\bf(A)');
                 ylabel('\bf\itV_{T} \rm\bf(V)');
                 title ('\bfTerminal Characteristic of a Shunt DC Generator');
                 hold off;
                 axis( [ 0 50 0 120]);
                 grid on;



































                                                           258
   259   260   261   262   263   264   265   266   267   268   269