How do you write a Matlabt program to determine what type of tropical system and
ID: 3831997 • Letter: H
Question
How do you write a Matlabt program to determine what type of tropical system and/or category hurricane a system is depending on the wind speed. For example winds in a tropical system at 35 MPH means that the system is a tropical depression. If the winds are at 50 MPH, then the system is a tropical storm. If the winds are at 100 MPH, the system is a category two hurricane. Also, write a similar program on the Fujita Scale for tornados. For example, if the winds are at 75 MPH, the tornado is on the F1 (Fujita One) scale. If the winds are at 105 MPH, the winds are on the F1 scale. If the winds are at 140 MPH, the tornado is on the F2 scale. For the hurricane and tornado speeds take three wind speeds from each of the ranges listed (below). Enter the wind speed values into the program. Use that wind speed in an assignment statement or input command for inputs into the program. Use the disp or fprint function to show the output of what type of storm the hurricane and tornado are. For more on the assignment statement, input, disp or fprintf, go to especially Lecture Notes six and seven. Use the pseudo codes as a guide to write the program. Hint: Look also at string variables and/or string commands. For hurricanes 30 < wind speed < 60 74 < wind speed < 100 100 < wind speed < 150 For tornados 40 < wind speed < 112 112 < wind speed < 157 157 < wind speed < 206 Have a copy of the MATLAB code and a screen shot of the results. Put the program and results into the dropbox in Folio. The program is where the wind speed is the input while the output is the type of storm, tropical depression, tropical depression, or category hurricane. For a tornado the outputs are the F0, F1, F2, F3, F4, or F5 scale. The MATLAB codes for each (hurricane and tornado) can be included into the same program. Hurricane pseudo code Enter the wind speed. if winds are less than 39 MPH storm = tropical depression elseif the winds are greater than or equal to 39 MPH and less than 74 MPH storm = tropical storm elseif the wind are greater than or equal to 74 MPH and less than or equal to 95 MPH storm = category one hurricane elseif the wind are greater than or equal to 95 MPH and less than or equal to 110 MPH storm = category two hurricane elseif the wind are greater than or equal to 110 MPH and less than or equal to 129 MPH storm = category three hurricane elseif the wind are greater than or equal to 129 MPH and less than or equal to 156 MPH storm = category four hurricane else storm = category five hurricane Print the type of storm Or the code could be written this way. Enter the wind speed. if winds < 39 MPH storm = tropical depression elseif the winds > 39 MPH and < 74 MPH storm = tropical storm elseif the winds 74 MPH and < 95 MPH storm = category one hurricane elseif the winds 95 MPH and 110 MPH storm = category two hurricane elseif the winds 110 MPH and 129 MPH storm = category three hurricane elseif the winds 129 MPH and 156 MPH storm = category four hurricane else storm = category five hurricane Print the type of storm. Tornado pseudo code Enter the wind speed. if winds are between 40 and 72 MPH The tornado is on the F0 scale. elseif the winds are between 73 and 112 MPH The tornado is on the F1 scale. elseif the winds are between 113 and 157 MPH The tornado is on the F2 scale. elseif the winds are between 158 and 206 MPH The tornado is on the F3 scale. elseif the winds are between 207 and 206 MPH The tornado is on the F4 scale. elseif the winds are between 261 and 318 MPH The tornado is on the F5 scale. else The wind speed is not on the scale.
Explanation / Answer
function tropicalHurricane (speed)
if speed < 39
disp("Tropical depression")
elseif speed < 74 %note that more than 40 is not explicitly defined here
disp("Tropical storm")
elseif speed < 95
disp("Categoti one hurricane")
elseif speed < 110
disp("Categoti two hurricane")
elseif speed < 129
disp("Categoti three hurricane")
elseif speed < 156
disp("Categoti four hurricane")
else
disp("Categoti five hurricane")
end
end
function tropicalTornedo (speed)
if speed >= 40 && speed <= 72
disp("Tornedo is on F0 scale")
elseif speed >= 73 && speed <= 112 %but here we need to explicitly define >= 73 here. If not done, speed less than 40 will move into this group
disp("Tornedo is on F1 scale")
elseif speed >= 113 && speed <= 157
disp("Tornedo is on F2 scale")
elseif speed >= 158 && speed <= 206
disp("Tornedo is on F3 scale")
elseif speed >= 207 && speed <= 260
disp("Tornedo is on F4 scale")
elseif speed >= 261 && speed <= 318
disp("Tornedo is on F5 scale")
else
disp("Speed not on scale")
end
end
%For hurricane samples
tropicalHurricane(10)
tropicalHurricane(20)
tropicalHurricane(30)
tropicalHurricane(40)
tropicalHurricane(50)
tropicalHurricane(60)
tropicalHurricane(70)
tropicalHurricane(80)
tropicalHurricane(90)
tropicalHurricane(98)
tropicalHurricane(100)
tropicalHurricane(108)
tropicalHurricane(115)
tropicalHurricane(120)
tropicalHurricane(125)
tropicalHurricane(130)
tropicalHurricane(140)
tropicalHurricane(150)
%For tornedo samples
tropicalTornedo(10)
tropicalTornedo(20)
tropicalTornedo(30)
tropicalTornedo(40)
tropicalTornedo(50)
tropicalTornedo(60)
tropicalTornedo(70)
tropicalTornedo(80)
tropicalTornedo(90)
tropicalTornedo(100)
tropicalTornedo(110)
tropicalTornedo(120)
tropicalTornedo(130)
tropicalTornedo(140)
tropicalTornedo(150)
tropicalTornedo(170)
tropicalTornedo(190)
tropicalTornedo(210)
tropicalTornedo(240)
tropicalTornedo(270)
tropicalTornedo(300)
tropicalTornedo(330)
tropicalTornedo(360)
tropicalTornedo(400)
I tried my best to keep the logic and code as simple as possible. I have also added comments at some location which may be useful. If incase you need more information about the code, please feel free to comment below. I shall be glad to help you with the same.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.