Answered step by step
Verified Expert Solution
Question
1 Approved Answer
matlab 8.5 -Vector of Structures A team of engineers is designing a bridge to span the Podunk River. As part of the design process, the
matlab
8.5 -Vector of Structures A team of engineers is designing a bridge to span the Podunk River. As part of the design process, the local flooding data must be analyzed. The following information on each storm that has been recorded in the last 40 years is stored in a file: a code for the location of the source of the data, the amount of rainfall (in inches), and the duration of the storm (in hours), in that order. For example, the file might look like this: 321 2.4 1.5 111 3.3 12.1 ...etc. Note: This problem is a subset of Problem 2 from the worksheet. Additionally, we are having you write this part as a script, while the worksheet asks for it as a function. Please note the difference! We have created a data file. Write the first part of the program: design a data structure to store the storm data from the file, and also the intensity of each storm. Please use the field names: code, amount, duration, and intensity. The intensity is the rainfall amount divided by the duration. Write a script to read the data from the file (use load) into the variable "mydata", then copy from the matrix into a vector of structs called "vecdata" and also calculate the intensities (these calculated intensities should be the values in the field called intensity) Your final vector of structures should have the same number of elements as the number of rows in the data file. Additionally, it should have the 4 fields with the names specified earlier Your Script C Reset MATLAB Documentation % Creating an example data file (do not change anything here): 2 anum = randi(3,101); 3 thedata = [randi( [1,350] , anum, 1), rand ( anum, 1)*5, rand (anun, 1 ) *151; 4 save mydata.dat thedata -ascii 5 clear 71% write your expressions here. First, load the data using the load function into "mydata". 8 9 0 %Next, copy-the-data from mydata" into a vector of structures called "vecdata" Run ScriptStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started