ruiweekly.m


A simple function

edit RUIweekly.m

% this function is try to compute how Rui’s comprehensive ability change in one week, though it is really simple and not very precise, it can still reflect Rui’s life to some extent.

% output: ‘Rui_socre’ is a number to describe the comprehensive ability of Rui

% input:

% ‘mood’ is a binary value vector, ‘1’ means positive mood, and ‘0’ means negative mood.

% ‘trouble’ is a vector, which record the troubles Rui meets everyday

% ‘trouble_score’ is the weight of trouble

% ‘achieve’ is a vector, which record the achievements Rui makes everyday

% ‘achieve_score’ is the weight of achieve

function [Rui_score] = RUIweekly (mood, trouble, trouble_score, achieve, achieve_score)

index=find(mood==0);

mood(index)=1;

for i=1:7

  Rui_socre = Rui_socre mood(i) + trouble(i) trouble_score(i) + achieve(i) * achieve_score(i);

end