An unmanned X43 A scramjet test vehicle has achieved a maxim
An unmanned X-43 A scramjet test vehicle has achieved a maximum speed of Mach number 9.68 in a test flight over the Pacific Ocean. Mach number is defined as the speed of an object divided by the speed of sound. Assuming the speed of sound is 343 meters per second, write a MATLAB program to determine speed in units of miles per hour. Your program should ask the user to provide the speed as Mach number and return the speed in miles per hour in a formatted sentence, displayed as an integer value, as shown in the sample output below. If the user provides a negative value for the Mach number, your program should display an error message and terminate.
Solution
close all
clear all
clc
% MATLAB program to determine speed in miles/hr
c=343; % speed of sound in m/s
M=input(\'enter Mach number\');
if M<0
disp(\'The Mach number must not be negative\')
break
end
v=M*c*3600/(5280*0.3048); % velocity in miles/hr
V=round(v);
fprintf(\'%s The Speed of the plane %d in miles/hr\',M,V)
