Search for question
Question

Question 1 - Matrix manipulation [8 Marks] 1.1 The file assessment_data.mat should be in your working directory, load the .mat file programmatically. [1 mark] 1.2 The file contains a matrix called

pressure. The matrix pressure contains a measure of pressure in N/m² across a sampled surface. In the sample, there is an erroneous reading present, looking at the data, it should be obvious which sample it is. Using an appropriate method, programmatically determine the location of this reading. The result should be two scalar values named error_row and error_column signifying the row and column location respectively. Hint: type help isnan. [1 marks] 1.3 To remove the erroneous reading we want to replace it with the average pressure of the surrounding 8 values, i.e. the 8 values in the border of a 3x3 square, centred on the erroneous value. Determine this value and assign to a variable average_pressure. [2 marks] 1.4 Replace the erroneous values at location given by error_row and error_column with the value in average_pressure. The result should still be a matrix called pressure. [1 mark] 1.5 There are two additional rows of sample data that need to be added to the pressure matrix. additional_data was loaded from the assessment_data.mat. Add the first row of additional_data to the start of the pressure matrix and add the second row of additional_data to the bottom of the pressure matrix. The new matrix should be named new_pressure. It should have two more rows than the original pressure matrix. (Make sure you have not changed the values in pressure from question 1.4). [2 marks] 1.6 If a value of over 40 N/m² is considered high pressure, determine the percentage of the new_pressure matrix that are at or above a high pressure value and set to a variable percentage_over and round it to the nearest integer. [1 marks]

Fig: 1