How to produce a code that will present a grading scale?
显示 更早的评论
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 个评论
Walter Roberson
2018-1-26
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" ?
回答(2 个)
Star Strider
2018-1-26
0 个投票
Image Analyst
2018-1-28
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.
类别
在 帮助中心 和 File Exchange 中查找有关 Image Filtering and Enhancement 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!