How to produce a code that will present a grading scale?
Show older comments
Hello, I am incredibly new to MATLAB. I've been trying to create a code that simulates a grading scale where a 93 equating to a perfect score (because that was the highest score achieved). Essentially, I want to be able to curve test scores onto a regular grading scale but I have no idea where to start.
1 Comment
Walter Roberson
on 26 Jan 2018
Insufficient information about how you want to grade. Are there any "hard" fail points -- e.g., should 40 always fail even if the maximum mark achieved was 75? Should a certain fraction fail? For example if everyone was between 80 and 93 then should the 80's fail? Do you just want to multiply each mark by 100/highest_score, or do you want to grade "on a curve" ?
Answers (2)
Star Strider
on 26 Jan 2018
0 votes
Image Analyst
on 28 Jan 2018
Will this work?
scaledScores = 100 * scores / 93;
The min will be at a value of 100/93 of whatever it used to be.
Or, if you want the min (whatever that is) to be 0 and the max (whatever that is) to be 100, and you have the Image Processing Toolbox, you can use mat2gray():
scaledScores = 100 * mat2gray(scores);
Or simply scale manually
minScore = min(scores);
maxScore = max(scores);
scaledScores = 100 * (scores - minScore) / (maxScore - minScore);
Of course, make it robust for checking for the unlikely situation that the min and max are the same value.
Categories
Find more on Image Filtering and Enhancement in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!