The super elevation angle for a vehicle going around a curve assuming no frictio
ID: 3595034 • Letter: T
Question
The super elevation angle for a vehicle going around a curve assuming no friction is :
theta = tan^-1 (V^2 / gR)
Write a matlab script that prompts the user for the units of speed (m/s or mph) and prompts the user for the vehicle's speed (V).
Outputs a message to the user if the speed entered is invalid (cannot be negative) and ends the program.
If the speed entered is a valid value:
*Prompts the user for the bank angle of the curve (assume units of degrees)
*Converts speed to m/s if needed (1 mph = 0.447 m/s)
*Calculates the super elevation angle, theta in degrees, Assume g = 9.81 m/s^2 and R = 300m.
*Outputs the super elevation angle, theta in degrees, using 2 places behind the decimal point and includes units
* Compare the super elevation angle to the bank angle entered by the user. If the super bank elevation angle is greater than the bank angle, output a message indicating that the vehicle speed is too fast for the curve. If the super elevation angle is less than the bank angle, output a message that the vehicle speed is safe. If the super elevation angle is less than the bank angle, output a message that the vehicle speed is safe. Otherwise, output a message that the vehicle speed is right at the safe limit.
Will give thumbs up for correct answer. Matlab script needed.
Explanation / Answer
The script has been written as asked. Please note that the line theta = round(theta*100)/100; is optional. It is needed only if you want theta to be converted to 2 decimal place accuracy for further comparisons. In any case, it will display the theta value in 2 decimal places only because of the usage of %.2f while printing. Please upvote my answer if you find this useful.
s_unit = input('Enter unit of speed (m/s or mph): ','s');
if ~strcmp(s_unit,'m/s') && ~strcmp(s_unit,'mph')
disp('Invalid unit of speed.');
return
end
convert = 0;
if strcmp(s_unit,'mph')
convert = 1;
end
V = input('Enter vehicle speed: ');
if V<0
disp('Invalid speed entered.');
return
end
bank_angle = input('Enter bank angle in degrees: ');
if convert == 1
V = 0.447 * V;
end
theta = rad2deg(atan(V^2/(300*9.81)));
% Comment the line below if you want higher precision in theta values
% Currently it is rounding it up to 2 decimal places
theta = round(theta*100)/100;
fprintf('Super elevation angle: %.2f degrees ',theta);
if theta>bank_angle
disp('Vehicle speed is too fast for the curve');
elseif theta<bank_angle
disp('Vehicle speed is safe');
else
disp('Vehicle speed is right at the safe limit');
end
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.