function ee340lab7(Shunt, Comp, Series) for k=1:1:3; if k==1, data7=Shunt; fprintf('\n\n Table I: Results for the dc shunt excited motor \n') elseif k==2, data7=Comp; fprintf('\n\n Table II: Results for the dc compound excited motor \n') elseif k==3; data7=Series; fprintf('\n\n Table III: Results for the dc series motor \n') else, end V = data7(:,1)'; % Supply voltage Ia=data7(:,2)'; % Armature current If=data7(:,3)'; % Field current n= data7(:,4)'; % Speed in RPM Pull=data7(:,5)'; % Pull in Kg % Calculated data if k==3, IL=Ia; % Series excited motor else, IL = Ia+If; % Shunt & Compound end Pi = V.*IL; % Motor input power T=Pull*9.81*0.305; % Torque Eq. (7.11) w = 2*pi*n/60; % Speed in Rad/sec. Po=w.*T; % Motor output power Eq. (7.12) Eff = Po./Pi*100; % Motor efficiency fprintf(['\n V I_a I_f n Pull I_L P_i T P_o Eff\n']) fprintf('%7.2f %6.2f %5.2f %7.1f %5.2f %6.2f %8.2f %5.2f %8.2f %6.2f\n',... [V; Ia; If; n; Pull; IL; Pi; T; Po; Eff]); % Terminal voltage & Eff. plots nn(1)= 2; nn(2)= 2; nn(3)=2;% Poly. order for curve fitting % if necessary change the order cn=polyfit(T, n,nn(k)); % Returns polynomial coefficients for n/Tcurve nfit=polyval(cn, T); % Evaluates the polynomial values for n/Tcurve nT(1)= 2; nT(2)=2; nT(3)=2; % poly. order, for curve fitting % if necessary change the order cT=polyfit(Ia, T, nT(k)); % Returns polynomial coefficients for Eff-curve Tfit=polyval(cT, Ia); % Evaluates the polynomial values for Eff-curve nEff(1)= 2; nEff(2)=2; nEff(3)=2; % poly. order, for curve fitting % if necessary change the order cF=polyfit(Po, Eff, nEff(k)); % Returns polynomial coefficients for Eff-curve Effit=polyval(cF, Po); % Evaluates the polynomial values for Eff-curve if k==1, figure(1), plot(T, n, 'xr', T, nfit, 'r' ) hold on figure(2), plot(Ia, T,'xr', Ia, Tfit, 'r') hold on figure(3), plot(Po, Eff,'xr', Po, Effit, 'r') hold on elseif k==2, figure(1), plot(T, n, 'xm', T, nfit, 'm' ) figure(2), plot(Ia, T,'xm', Ia, Tfit, 'm') hold on figure(3), plot(Po, Eff,'xm', Po, Effit, 'm') elseif k==3, figure(1), plot(T, n, 'xb', T, nfit, 'b' ) figure(2), plot(Ia, T,'xb', Ia, Tfit, 'b') hold on figure(3), plot(Po, Eff,'xb', Po, Effit, 'b') else, end figure(1), Legend('Shunt', ' ',' Comp', ' ', 'Series', ' ', 3) figure(1),title('DC Motor Speed-Torque Characteristics') figure(1), xlabel('T, N-m'), figure(1), ylabel('n, RPM') figure(2), title('DC Motor Torque-Current Characteristics') figure(2), xlabel('I_a, Amps') figure(2), ylabel('T, N-m') figure(2), Legend('Shunt', ' ',' Comp', ' ', 'Series', ' ', 4) figure(3), Legend('Shunt', ' ',' Comp', ' ', 'Series', ' ', 4) figure(3),title('DC Motor \eta-P_o Characteristics') figure(3), xlabel('P_o, Watts'), figure(3), ylabel('\eta, %') end