function torque = engine_model_CJP (speed); %ENGINE_MODEL Determines the engine torque for a given engine speed % TORQUE = ENGINE_MODEL(SPEED) determines the engine torqe for a % given engine speed, assuming full throttle % % Inputs: % SPEED: a scalar or vector of engine speed values in [rad/s] % % Outputs: % TORQUE: a vector of the same size as the input SPEED % containing the corresponding engine TORQUE values % expressed in [Nm] % % Assumptions: all the inputs are within the range from 500 to 6500 % rpm. Inputs outside that range will result in a warning. % % %% ME 2016 Section %% Fall 2007 %% %% AUTHOR: Chris Paredis %% % first check whether the input is valid stall_speed = 500*pi/30; %lower limit in [rad/s] redline_speed = 6500*pi/30; % upper limit in [rad/s] if any(speedredline_speed) warning(sprintf('input speed must be with the range [%g,%g]rad/s',... stall_speed, redline_speed)); end % use the Matlab function polyval to evaluate polynomials poly_coeff = [-6.4e-14, 1.16e-10, -8.3e-8, 2.9e-5, -5.5e-3, 0.76, 170]; torque = polyval(poly_coeff, speed); return;