Cody

# Problem 46657. Grouped Frequency Distributions

Solution 3074036

Submitted on 5 Oct 2020 by William
• Size: 67
• This is the leading solution.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
dataset = [20 25 35 40 20 14 16 15 ... 14 16 13 10 23 28 29 30 34 32 ... 14 17 11 10 7 5 2 7 7 ]; numClass = 4; y_correct = [2,12,8;12,22,10;22,32,5;32,42,4]; assert(isequal(groupedFreq(dataset,numClass),y_correct))

2   Pass
dataset = [-52;5;2;-68;-74;-20;45;-43;-8;-59;15;-55;-19;8;35;45;-13;-71;-69;-54;28;-55;24;-56;41;-41;-63;-55;-4;-24;-41;27;-8;-13;39;-50;16;16;-37;-10;-80;-83;-16;19;41;-72;-10;-24;-89;-43]; numClass = 5; y_correct = [-89,-55,11;-55,-21,13;-21,13,13;13,47,13;47,81,0]; assert(isequal(groupedFreq(dataset,numClass),y_correct))

3   Pass
dataset = [138,0,69,64,69,116,48,118,71,5,26,108,71,23,51,91,28,111,36,138,40,115,28,43,13,87,103,82,64,97,97,102,96,142,31,107,35,18,91,67,69,99,116,52,99,62,127,125,38,92,87,81,131,39,48,18,141,97,72,96,82,97,82,108,78,150,33,15,16,9,61,67,55,115,94,116,140,146,28,20,105,14,79,80,130,73,59,101,111,78,52,22,88,39,6,113,36,66,103,54,111,59,103,106,66,2,49,64,40,29,124,64,134,59,116,59,122,114,56,32,119,143,49,101,66,125,116,25,130,149,77,133,88,23,30,61,113,124,119,48,80,13,16,20,102,74,28,74,22,8]; numClass = 4; y_correct = [0,38,34;38,76,42;76,114,43;114,152,31]; assert(isequal(groupedFreq(dataset,numClass),y_correct))

4   Pass
dataset = [-56;45;26;126;3;9;-74;-91;45;0;60;-51;173;30;104;2;7;75;64;-70;-103;-68;-93;25;-13;-9;-89;82;55;13;102;-50;53;48;48;-38;46;-21;-52;-76;103;-48;6;-77;-4;-239;-67;-94] numClass = 5; y_correct = [-239,-136,1;-136,-33,17;-33,70,23;70,173,6;173,276,1]; assert(isequal(groupedFreq(dataset,numClass),y_correct))

dataset = -56 45 26 126 3 9 -74 -91 45 0 60 -51 173 30 104 2 7 75 64 -70 -103 -68 -93 25 -13 -9 -89 82 55 13 102 -50 53 48 48 -38 46 -21 -52 -76 103 -48 6 -77 -4 -239 -67 -94

5   Pass
dataset = [383;129;199;139;119;128;105;23;179;241;47;293;82;76;10;21;5;135;260;153;185;234;387;83;135;172;-30;-1;179;88;155;4;-63;176;219;263;-53;-34;-47;96;38;231;-46;-74;121;219;20;-27;85;-64;102;183;122;390;46;70;281;191;94;231;-4;65;241;250;173;149;41;174;17;157;128;214;57;164;179;10;116;260;111;69;146;72;144;87;98]; numClass = 5; y_correct = [-74,42,21;42,158,35;158,274,24;274,390,4;390,506,1]; assert(isequal(groupedFreq(dataset,numClass),y_correct))

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!