reading = [77;66.9016000000000;67.0833000000000;66.1000000000000;66.3115000000000;66.3934000000000;86.8525000000000;78.7288000000000;66.4918000000000;66.7833000000000;67.3667000000000;66.7541000000000;68.2034000000000;67.5833000000000;65.7869000000000;66.4068000000000;85.3443000000000;90.9667000000000;66.3667000000000;67.9500000000000;69.7833000000000;67.6441000000000;66.9667000000000;66.1167000000000;65.6721000000000;67.4576000000000;69.1167000000000;96.6333000000000;66.4918000000000;66.3443000000000;66.9830000000000;78.5410000000000;67.3729000000000;66.5574000000000;66.5667000000000;66.8644000000000;68.3934000000000;110.610000000000;66.8500000000000;66.9167000000000;70.9508000000000;68.1695000000000;67.2667000000000;];
data = reading ;
transFreq = zeros(22,22);
transCount = zeros(22,22);
i = 1;
for i = 1:length(data)
if (i < 2)
[previousState currentState] = statv2([data(i,1) data(i,1)]);
transCount(previousState, currentState) = transCount(previousState,currentState) + 1;
end
if (i >= 2)
data(i-1,1);
data(i,1);
[previousState currentState] = statv2([data(i-1,1) data(i,1)]);
transCount(previousState, currentState) = transCount(previousState, currentState) + 1;
end
end
for j = 1:22
transFreq(j,:) = transCount(j,:)/ sum(transCount(j,:));
end
function [state_prev,state_current] = statv2(x)
if (x(1) <= 5)
state_prev = 1;
end
if (x(1) > 5 && x(1) <= 10)
state_prev = 2;
end
if (x(1) > 10 && x(1) <= 15)
state_prev = 3;
end
if (x(1) > 15 && x(1) <= 20)
state_prev = 4;
end
if (x(1) > 20 && x(1) <= 25)
state_prev = 5;
end
if (x(1) > 25 && x(1) <= 30)
state_prev = 6;
end
if (x(1) > 30 && x(1) <= 35)
state_prev = 7;
end
if (x(1) > 35 && x(1) <= 40)
state_prev = 8;
end
if (x(1) > 40 && x(1) <= 45)
state_prev = 9;
end
if (x(1) > 45 && x(1) <= 50)
state_prev = 10;
end
if (x(1) > 50 && x(1) <= 55)
state_prev = 11;
end
if (x(1) > 55 && x(1) <= 60)
state_prev = 12;
end
if (x(1) > 60 && x(1) <= 65)
state_prev = 13;
end
if (x(1) > 65 && x(1) <= 70)
state_prev = 14;
end
if (x(1) > 70 && x(1) <= 75)
state_prev = 15;
end
if (x(1) > 75 && x(1) <= 80)
state_prev = 16;
end
if (x(1) > 80 && x(1) <= 85)
state_prev = 17;
end
if (x(1) > 85 && x(1) <= 90)
state_prev = 18;
end
if (x(1) > 90 && x(1) <= 95)
state_prev = 19;
end
if (x(1) > 95 && x(1) <= 100)
state_prev = 20;
end
if (x(1) > 100 && x(1) <= 105)
state_prev = 21;
end
if (x(1) > 105 && x(1) <= 110)
state_prev = 22;
end
if (x(2) <= 5)
state_current = 1;
end
if (x(2) > 5 && x(2) <= 10)
state_current = 2;
end
if (x(2) >10 && x(2) <= 15)
state_current = 3;
end
if (x(2) > 15 && x(2) <= 20)
state_current = 4;
end
if (x(2) > 20 && x(2) <= 25)
state_current = 5;
end
if (x(2) > 25 && x(2) <= 30)
state_current = 6;
end
if (x(2) > 30 && x(2) <= 35)
state_current = 7;
end
if (x(2) > 35 && x(2) <= 40)
state_current = 8;
end
if (x(2) > 40 && x(2) <= 45)
state_current = 9;
end
if (x(2) > 45 && x(2) <= 50)
state_current = 10;
end
if (x(2) > 50 && x(2) <= 55)
state_current = 11;
end
if (x(2) > 55 && x(2) <= 60)
state_current = 12;
end
if (x(2) > 60 && x(2) <= 65)
state_current = 13;
end
if (x(2) > 65 && x(2) <= 70)
state_current = 14;
end
if (x(2) > 70 && x(2) <= 75)
state_current = 15;
end
if (x(2) > 75 && x(2) <= 80)
state_current = 16;
end
if (x(2) > 80 && x(2) <= 85)
state_current = 17;
end
if (x(2) > 85 && x(2) <= 90)
state_current = 18;
end
if (x(2) > 90 && x(2) <= 95)
state_current = 19;
end
if (x(2) > 95 && x(2) <= 100)
state_current = 20;
end
if (x(2) > 100 && x(2) <= 105)
state_current = 21;
end
if (x(2) > 105 && x(2) <= 110)
state_current = 22;
end