Experiment No:01 Name of The Experiment: Finding The Average of CT Marks Using MATLAB
Experiment No:01 Name of The Experiment: Finding The Average of CT Marks Using MATLAB
Objective:
1. To find CT marks average using MATLAB
2. To find the output in table of command window.
Procedure: The CT marks were stored in Microsoft Excel File.By changing the directory using 'cd'
function in MATLAB ,the excel file was called.
Then, the documents were kept in a matrix. Roll no colum was saperated .Then, CT marks were sort
into decending order by calling another matrix .Another matrix was called to sum CT marks. After
that, another matrix stored the average.
Here we set a level for fractional number. We have used for loop for this program, here the
fractional digit less then 0.25 will not be with its integer number . Greater then 0.25 & less then
0.5 will be added 0.5 to the actual integer number and finally of greater then 0.75 will be counted
after adding 1 with actual integer number. Finally, table function was called to display the output in
table form.
Program of CT marks:
clc
clear
format long
cd('C:\Users\Shaharior Anik\Desktop') %To read the location of
excel file
[a]= xlsread('Marks');
b = a(:,1);%ROLL
c = a(:,2:6);%MARKS
d=sort(c,2,'descend'); %ROW_SORT_i.e.marks
e=d(:,1:3);%Best_three
f= sum(e');%sum_of_rows_i.e.marks
g=f/3;%average of CT marks
h=g-floor(g);
for i=1:length(h)
if h(i)>=0 && h(i)<0.25
g(i)= floor (g(i));
elseif h(i)>0.25 && h(i)<0.75
g(i)=floor(g(i))+0.5;
elseif h(i)>0.75 && h(i)<1
g(i)=floor(g(i))+1;
end
end
% h=round(g);
i=g';%Transpose of g matrix
Roll=b(:,1);%Roll numbers are taken
CT1=c(:,1);
CT2=c(:,2);
CT3=c(:,3);
CT4=c(:,4);
CT5=c(:,5);
Average=i(:,1);
t=table(Roll,CT1,CT2,CT3,CT4,CT5, Average)
1601061 10 9 7 13 17 13.5
1601062 20 11.5 15 18 19 19
1601063 15 2 14.34 19 18 17.5
1601064 19 4 16 5 20 18.5
1601065 11 19 20 9.2 7 16.5
1601066 12 9 14.7 13.5 4 13.5
1601067 11 9 13 16 20 16.5
1601068 6 12 11 12 16 13.5
1601069 4 13 18 19 3 16.5
1601070 18 12 2 8.9 0 13
1601071 12 16 12.7 17 17 16.5
1601072 16 9 4 11.5 0 12
1601073 2 2 19 19 20 19.5
1601074 13 5 25 2 18 18.5
1601075 19 9 11 11.5 19.5 16.5
1601076 14 13 12 17 1 14.5
1601077 9 1 19 20 13 17.5
1601078 3 14 11 7 19.5 15
1601079 5 5 2 7 12 8
1601080 11 11 11.6 16.7 11 13
Discussion :In this experiment ,the finding the average of CT marks was performed .Many
types of functions such as cd, xlsread , sort ,table ,forloop ,if function ,floor were
performed .The experiment was successfully performed.