Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function [p np ntpc npc npi] = parcialcalc(mrk,key,np)
- %PARCIALCALC Calculates partial score of questions, UFSC-style.
- % This function calculates the score reached on a certain
- % question, UFSC-style. It uses the following method:
- %
- % If NPC > NPI:
- % NP - (NTPC - ( NPC - NPI ) )
- % P = ------------------------------
- % NP
- % Else: P = 0
- %
- % Where:
- % P: Final score
- % NP: Number of prepositions (total)
- % NTPC: Number of total correct prepositions
- % NPC: Number of corrects prepositions marked
- % NPI: Number of incorrects prepositions marked
- %
- % It does some simple logic manipulations on the numbers
- % after converted it into a binary array.
- %
- % Usage:
- %
- % parcialcalc(sum,key,np)
- %
- % Where: mrk: the value marked by the person
- % key: the correct value
- % np: number of prepositions within the question
- %
- % It returns the following values respectively:
- % [P, NP, NTPC, NPC, NPI]
- bit_sum=de2bi(mrk,np);
- bit_key=de2bi(key,np);
- ntpc=sum(bit_key);
- npc=sum(bitand(bit_sum,bit_key));
- npi=sum(bitand(bit_sum,bitxor(bit_key,ones(1,np))));
- if npc > npi
- p=1-(ntpc-npc+npi)/np;
- else
- p=0;
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement