Add second year

This commit is contained in:
2023-12-07 01:19:12 +00:00
parent 3291e5c79e
commit 3d12031ab8
1168 changed files with 431409 additions and 0 deletions

View File

@ -0,0 +1,9 @@
function [grades] = clean_grades(grades)
for i = 1:(size(grades,1)*size(grades,2))
if grades(i) < 0
grades(i) = 0;
elseif grades(i) > 100
grades(i) = 0;
end
end
end

View File

@ -0,0 +1,4 @@
function [grades] = create_grades(rows, columns, min, max, seed)
rng(seed);
grades = randi([min max], rows, columns);
end

View File

@ -0,0 +1,25 @@
function [grades] = fill_estimates(grades)
for i = 1:size(grades, 2)
% making copy
copy = grades(:, i);
nonzero = 0; % count of nonzero elements to calculate avg
sum = 0; % sum of nonzero elements
% looping through copy and counting number of nonzero elements
for j = 1:size(copy,1)
if copy(j) ~= 0
nonzero = nonzero + 1;
sum = sum + copy(j);
end
end
avg = round(sum / nonzero);
% looping through original and replacing any nonzero with average
for j = 1:size(copy,1)
if grades(j,i) == 0
grades(j,i) = avg;
end
end
end
end

View File

@ -0,0 +1,4 @@
clear;
gr1 = create_grades(10,5,-10,110,100);
gr2 = clean_grades(gr1);
gr3 = fill_estimates(gr2);