function [Tmax,Wmax] = mtrpwr(Ts,Wn) % The Function mtrpwr returns the Torque of maximum power output (Tmax) % in [Nm] and the rotational speed of maximum power out (Wmax) in [rpm] % for and electric motor give the Stall Torque (Ts) in [Nm] and the No Load % Rotational Speed (Wn) in [rpm] of the motor. % This function makes the following plots: Power vs. Speed, Power vs. Torque % and Torque vs. Speed %By Roger Cortesi (Course 2 Class of 1999) wrpm = [0:1:Wn]; wrad = wrpm .* ( (2*pi)/60); Wnrad = Wn * ((2*pi)/60); tinc = Ts/100; t = [0:0.01:Ts]; tw = Ts - (Ts/Wnrad).*wrad; pr = wrad .* (Ts - (Ts/Wnrad).*wrad); pt = (Wnrad .* t) - ( (Wnrad/Ts).*(t.^2)); figure(1) plot(wrpm,pr); title('Power vs. Speed'); xlabel('Rotational Speed [rpm]'); ylabel('Power [Watts]'); grid on; figure(2) plot(t,pt); title('Power vs. Torque'); xlabel('Torque [Nm]'); ylabel('Power [Watts]'); grid on; figure(3) plot(wrpm,tw); title('Torque vs. Speed'); xlabel('Speed [RPM]'); ylabel('Torque [Nm]'); grid on; pmax = Ts*Wn/4; Tmax =Ts/2; Wmax =Wn/2;