A blizzard is a massive snowstorm. Definitions vary, but for our purposes, we will assume that a blizzard is characterized by winds of 30 mph or higher and blowing snow that leads to visibility of 0.5 miles or less, sustained for at least four hours. Create a file called stormtrack.dat. There should be 24 lines in the file, one for each hour of the day. Use the randi and rand functions to generate values for the wind speed and visibility at a location on each line such that the visibility values range from 0-5 miles and the wind speed ranges from 0-40mph. Read this data from the file and determine whether blizzard conditions were met during this day or not. If blizzard conditions exist at a particular hour, print a message that says "at XX winds were YY and visibility was ZZ'. After processing all 24 hours for a particular day, print a summary message that says either, "there was no blizzard today" or "there was a blizzard today".

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

5.25 matlab

A blizzard is a massive snowstorm. Definitions vary, but for our purposes, we will assume that a blizzard is characterized by winds of 30 mph or higher and blowing snow that leads to visibility
of 0.5 miles or less, sustained for at least four hours. Create a file called stormtrack.dat. There should be 24 lines in the file, one for each hour of the day. Use the randi and rand functions
to generate values for the wind speed and visibility at a location on each line such that the visibility values range from 0-5 miles and the wind speed ranges from 0-40mph. Read this
data from the file and determine whether blizzard conditions were met during this day or not. If blizzard conditions exist at a particular hour, print a message that says "at XX winds were YY
and visibility was ZZ'. After processing all 24 hours for a particular day, print a summary message that says either, "there was no blizzard today" or "there was a blizzard today".
Script
C Reset
MATLAB Documentation
Transcribed Image Text:A blizzard is a massive snowstorm. Definitions vary, but for our purposes, we will assume that a blizzard is characterized by winds of 30 mph or higher and blowing snow that leads to visibility of 0.5 miles or less, sustained for at least four hours. Create a file called stormtrack.dat. There should be 24 lines in the file, one for each hour of the day. Use the randi and rand functions to generate values for the wind speed and visibility at a location on each line such that the visibility values range from 0-5 miles and the wind speed ranges from 0-40mph. Read this data from the file and determine whether blizzard conditions were met during this day or not. If blizzard conditions exist at a particular hour, print a message that says "at XX winds were YY and visibility was ZZ'. After processing all 24 hours for a particular day, print a summary message that says either, "there was no blizzard today" or "there was a blizzard today". Script C Reset MATLAB Documentation
Expert Solution
Algorithm
  1. Generate 24 hours of data for wind speed and visibility using randi function.
  2. Open the file stormtrack.dat for writing using fopen function.
  3. Write the generated data to the file using fprintf function.
  4. Close the file using fclose function.
  5. Open the file stormtrack.dat for reading using fopen function.
  6. Read the data from the file using textscan function.
  7. Close the file using fclose function.
  8. Initialize the blizzard flag to false.
  9. Loop through each hour of data and check if the wind speed is greater than or equal to 30 mph and visibility is less than or equal to 0.5 miles.
  10. If the blizzard conditions are met, set the blizzard flag to true and print a message.
  11. After looping through all hours, if the blizzard flag is true, print the message "There was a blizzard today." If the blizzard flag is false, print the message "There was no blizzard today."
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Constants and Variables
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education