Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

USE MATLAB PROJECT-1 What to turn in: Copy the text from your scripts and paste it into a document. If a question asks you to

USE MATLAB

image text in transcribed

image text in transcribed

PROJECT-1 What to turn in: Copy the text from your scripts and paste it into a document. If a question asks you to plot or display something to the screen, also include the plot and screen output your code generates. Submit either a *.doc or *.pdf file. Write a script to read in some grades, curve them, and display the overall grade. To do this, you'll need to download the file classGrades.mat off the class website and put it in the same folder as your script. a. Open a script and name it calculateGrades.m. Write all the following commands in this script. b. Load the classGrades file using load. This file contains a single variable called namesAndGrades c. To see how namesAndGrades is structured, display the first 5 rows on your screen. The first column contains the students 'names', they're just the integers from 1 to 15. The remaining 7 columns contain each student's score (on a scale from 0 to 5) on each of 7 assignments. There are also some NaNs which indicate that a particular student was absent on that day and didn't do the assignment. d. We only care about the grades, so extract the submatrix containing all the rows but only columns 2 through 8 and name this matrix grades (to make this work on any size matrix, don't hard-code the 8, but rather use end or size(namesAndGrades,2)). e. Calculate the mean score on each assignment. The result should be a 1x7 vector containing the mean grade on each assignment. i. First, do this using mean. Display the mean grades calculated this way. Notice that the NaNs that were in the grades matrix cause some of the mean grades to be NaN as well. ii. To fix this problem, do this again using nanmean. This function does exactly what you want it to do, it computes the mean using only the numbers that are not Nan. This means that the absent students are not considered in the calculation, which is what we want. Name this mean vector meanGrades and display it on the screen to verify that it has no NaNs f. Normalize each assignment so that the mean grade is 3.5 (this is a B- on our 5 point scale). You'll want to divide each column of grades by the correct element of mean Grades i. Make a matrix called meanMatrix such that it is the same size as grades, and each row has the values meanGrades. Do this by taking the outer product of a 15x1 vector of ones and the vector meanGrades, which is a row (use ones, *). Display meanMatrix to verify that it looks the way you want. ii. To calculate the curved grades, do the following: curved Grades = 3.5 grades / meanMatrix). Keep in mind that you want to do the division elementwise. iii. Compute and display the mean of curvedGrades to verify that they're all 3.5 (nanmean). iv. Because we divided by the mean and multiplied by 3.5, it's possible that some grades that were initially close to 5 are now larger than 5. To fix this, find all the elements in curvedGrades that are greater than 5 and set them to 5. Use find g. Calculate the total grade for each student and assign letter grades i. To calculate the totalGrade vector, which will contain the numerical grade for each student, you want to take the mean of curvedGrades across the columns (use nanmean, see help for how to specify the dimension). Also, we only want to end up with numbers from 1 to 5, so calculate the ceiling of the totalGrade vector (use ceil). ii. Make a string called letters that contains the letter grades in increasing order: FDCBA iii. Make the final letter grades vector letterGrades by using totalGrade (which after the ceil operation should only contain values between 1 and 5) to index into letters. iv. Finally, display the following using disp: Grades: letterGrades 0 x Variables - namesAndGrades namesAndGrades x namesAndGrades 1 2 3 4 5 7 8 9 10 11 12 13 1 1 2.5064 3.6529 3.2324 2.4617 3.4737 3.3022 0.2378 6 2.5189 2.4480 4.6502 1.9951 2 2 0.0963 0.4194 4.8740 2.1586 3 4.9878 NaN 1.7439 4.3852 0.2370 3 4 4 4 4.0580 1.9914 2.2567 1.7657 3.2567 1.7119 5 5 2.4283 4.8637 1.6388 4.1890 3.6954 4.7709 2.2472 3.7491 4.1761 1.1562 3.6798 3.9734 6 NaN 3.5752 4.2809 6 4.8177 7 7 0.2115 4.4722 0.6877 1.9500 4.6368 NaN 3.4311 8 8 0.1596 2.0175 0.6101 1.3422 1.2892 1.6583 1.4075 9 4.4682 1.7843 3.3133 3.6553 0.6888 10 NaN 0.2740 3.5679 11 12 4.1836 1.6123 2.7613 4.8956 2.7465 1.6521 3.0974 1.8032 3.7825 2.0695 9 10 11 12 13 14 15 4.8648 0.9460 3.3356 2.9322 3.3756 1.8051 3.1014 4.0558 13 1.4075 1.1519 3.5556 3.1229 2.9530 3.0917 1.7164 4.6801 0.6239 0.6930 2.9410 1.8308 4.0338 0.7612 1.7400 0.6083 4.4208 0.4714 1.5183 0.2310 NaN 3.6008 3.6088 14 15 16 TOOTERICO 15 CUTTICOPT TO CO you want do the division elementwise

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions