CS1173MidtermpringPractice.docx - MidTerm Practice 1 Basic array syntax Suppose the MATLAB variable A is defined by A =[6-2 5 3 2 7-4-3 What are the

# CS1173MidtermpringPractice.docx - MidTerm Practice 1 Basic...

• 6

This preview shows page 1 - 3 out of 6 pages.

MidTerm Practice . 1. Basic array syntax. Suppose the MATLAB variable Aisdefined by:A = [6, -2, 5, 3; 2, 7, -4, -3]; What are the values of each of the following MATLAB expressions? Provide the resulting array/vector.a) Write Ain tabular form, showing the direction of dimension 1and dimension 2b) mean(A) c) A(:) d) reshape(A,4,2)e) min(A, [], 1) . 1
2. Translating simple word problems into MATLAB: Suppose the Texas Department of PublicHealth is tracking the number of tuberculosis deaths in an array (TBDeaths, 30 x 45), representing the number of new tuberculosis related deaths in the 30 least populous counties (in order low to high) in Texas over the years 1963-2017. a) Draw a diagram of the TBDeathsarray and label the rows and columns.b) Define a MATLAB variable that contains the overall total number of TB deaths for all counties during the recording period.c) Define a MATLAB variable that contains the total number of TB deaths in each county.d) Define a MATLAB variable to find the largest number of yearly TB deaths in each county. e) Calculate and use the fprintf statement to output the overall percent of TB deaths counted in Kendall county (the 8th least populous) as compared to the entire 30 counties.
• • • 