function force = resistance_force (vel_ms, slope) %RESISTANCE_FORCE Determines the air, tire, and gravity resistance force % FORCE = RESISTANCE_FORCE (VEL_MS, SLOPE) computes the total resistance % force due to air and tire resistance and gravity for a car running at a % velocity of VEL_MS and up a slope of SLOPE %. % % Inputs: % VEL_MS: a vector of car velocities expressed in [m/s] % SLOPE: a scalar containing the slope of the road surface in [%] % % Outputs: % FORCE: a vector of resistance forces expressed in [N]. FORCE has % the same dimensions as VEL_MS. % % % Assumptions: % - the air resistance is proportional to the velocity squared % - the rolling friction is proportional to the weight of the car % - there is no wind % - the slope is constant % - the car characteristics correspond approximately to those of a % Ford Taurus %% %% ME 2016 %% Fall 2007 %% %% AUTHOR: Chris Paredis %% % define the constants g = 9.81; % gravitational constant in [m/s2] air_density = 1.29; % [kg/m3] % define the car parameters mass = 1650; % [kg] drag_coefficient = 0.32; % dimensionless frontal_area = 2.2; % [m2] rolling_coefficient = 0.009; % dimensionless slope_rad = atan(slope/100); % slope in radians % compute drag force (wind and rolling): in [N] wind_resistance = 0.5*drag_coefficient*frontal_area*air_density * vel_ms.^2; rolling_resistance = (rolling_coefficient * mass * g * cos(slope_rad))*sign(vel_ms); gravity_resistance = mass*g*sin(slope_rad); % total resistance force = wind_resistance + rolling_resistance + gravity_resistance; return;