Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

HW5P2 (15 points) I need help with the whole question, not just the highlighted

ID: 3727742 • Letter: H

Question

HW5P2 (15 points)

I need help with the whole question, not just the highlighted part.

Thank you!!

NAME: PERSON #: LAB SECTION HW5P2 (15 points) In problem HW4P3 of your last homework, the grades of 3 sections were to be loaded to MATLAB script file one at a time. For the sake of comparison, we need to load the three data files (Grades_A.txt, Grades_B.txt and Grades_C.txt) to the same script file. You are required to write a MATLAB program in a script file HWSP2.m that does the following 1. (3 pts) Loads the three text files and assigns each data set to a variable name the same as the text file name without extension, for example, the data set Grades A.txt will be assigned to a variable name Grades A. 2. (5 pts) Your script must determine the average score for each section. You can use the mean ) built-in function in MATLAB to calculate the average (check the help of that function to understand how it works). Your display must be in the format "The average score for section S is xx.X." Where S refers to the name of the section and XX.X refers to the average score to be displayed. The script should display the previous text 3 times for the 3 sections. Use the fprintf ) command to display the texts. 3. (7 pts) Your script must determine the number of scores above the average in each section. This can be done by comparing the average score of each data set to every score in this particular data set and then use the MATLAB sum) function on the resulted vector. The output must be displayed as "Out of XX scores in section S, YY scores were above the average." XX refers to the total number of scores in each section, S refers to the section letter (A, B, or C) and YY refers to the number of scores above the average as determined by your script. The script should display the previous text 3 times for the 3 sections. Use the fprintf ) command to display the texts Hint: Use format i and f in fprintf) as required, to display the data.

Explanation / Answer

%Since you havent provided the file and data, i am assuming that the grades %are put one in one line for each of the three file %if the data is some other format, please tell in the comments, i will %change the code accordingly in no time Grades_A=load('Grades_A.txt'); Grades_B=load('Grades_B.txt'); Grades_C=load('Grades_C.txt'); fprintf('The average score for secion A is %3.1f. ',mean(Grades_A)); fprintf('The average score for secion B is %3.1f. ',mean(Grades_B)); fprintf('The average score for secion C is %3.1f. ',mean(Grades_C)); fprintf('Out of %2i scores in section A, %2i scores were above the average. ',length(Grades_A),sum(Grades_A>mean(Grades_A))); fprintf('Out of %2i scores in section B, %2i scores were above the average. ',length(Grades_B),sum(Grades_B>mean(Grades_B))); fprintf('Out of %2i scores in section C, %2i scores were above the average. ',length(Grades_C),sum(Grades_C>mean(Grades_C)));