Problem 44960. Rescale Scores
Solution Stats
Problem Comments
-
16 Comments
It appears the last column of the output from the problem statement should be 3.5; 0.0; 2.0 instead of 3.5; 0.0; 3.0, but the first test suite does have it correct.
yes true, thank you
Thank you! Modified the problem statement.
Why doesn't it work?
function X = rescale_scores(X)
X = [X(1:end,1:end-1) (X(1:end,end).-60)./4]
end
A little bit of math work will make your program much simpler. Grade 60-100 for GPA 0 - 4, this is a straight line! The equation for this straight line is GPA = 0.1*(grade-60). Don't forget to take care of negative GPAs.
X(:,end)=mean(rescale(X(:,end-1),-6,4,'InputMin',0,'InputMax',100),2);
Don't forget the negative numbers.
Score GPA
90 - 100 3 - 4
80 - 90 2 - 3
70 - 80 1 - 2
60 - 70 0 - 1
50 - 60 -1 - 0
40 - 50 -2 - -1
30 - 40 -3 - -2
20 - 30 -4 - -3
10 - 20 -5 - -4
0 - 10 -6 - -5
I am getting confused. IIs there a capital and small "x" in use. Getting errors.
Below 60 GPA=0, so why there could be any negative value?
"Assume that no student in this class has scored below 60." - not true in the test cases!
I am with jklebes
"Assume that no student in this class has scored below 60." - not true in the test cases!
The test suite has been corrected.
The problem is poorly posed. Per the instructions, a 70 or a 71 would result in a GPA of 1.0. A 80 or 81 would be a 2.0. 90 or 91 is a 3.0.
Thankfully the example shows the correct expected output.
Test 3 does not make any sense!
This problem is actually better off without the function rescale. And to say it all the rescale function itself is more something for the uneducated in basic arithmetics,
Test 3 should be 70 80 60 70
Dear MATLAB & Cody friends, I had a issue with the values of test 3, where it says that the score for the 2 row it should be 1.5... but for that case, thw values on the Entry Data table should be: 70-80-75-75 or any mix of those value.
If anyone of the Cody program can check this out, it would be great for the upcoming students.
Solution Comments
Show comments
Problem Recent Solvers6236
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!