Transitionmatrix needs to be converted from day to one tenth of a day.
2 views (last 30 days)
Show older comments
Hello,
i have a transitionmatrix that describes a population from one day to the other. I need to convert the transitionsmatrix so that one multiplication of my population with the matrix equals one tenth of a day instead of a full day. I already got a suggestion to use the squareroot, that only works with a single number but not within a transitionmatrix (atleast it did not work for me).
The folowing code is used to calculate:
%development rates of each stage
dpreg = 0.172;
dprL1 = 0.217;
dprL2 = 0.313;
dprL3 = 0.222;
dprL4 = 0.135;
dprPu = 0.099;
%relative mortality rates of each stage
rmreg = 0.017;
rmrL1 = 0.060;
rmrL2 = 0.032;
rmrL3 = 0.022;
rmrL4 = 0.020;
rmrPu = 0.020;
rmrAd = 0.027;
B1 = [1-(dpreg+rmreg),0,0,0,0,0,0;
dpreg,1-(dprL1+rmrL1),0,0,0,0,0;
0,dprL1,1-(dprL2+rmrL2),0,0,0,0;
0,0,dprL2,1-(dprL3+rmrL3),0,0,0;
0,0,0,dprL3,1-(dprL4+rmrL4),0,0;
0,0,0,0,dprL4,1-(dprPu+rmrPu),0;
0,0,0,0,0,dprPu,1-rmrAd];
A = [10;10;10;10;10;10;10];
%%this loop can be used to calculate the result for 10 days to check whether it is the same %result, to do so change the 1:1 to 1:10
for i = 1:1
C = B1*A;
A=C;
end
Thanks a lot
Best regards Dominik
0 Comments
Accepted Answer
Rohit
on 18 Apr 2023
Hi Dominik,
I understand that you are trying to convert the transition matrix so that one multiplication of the population with the matrix equals one tenth of a day instead of a full day.
To achieve this, you can simply take the transition matrix to the power of 1/10.
Taking the matrix to the power of 1/10 is equivalent to multiplying the matrix with itself 1/10 times, which is what we want to achieve to scale the transition matrix for one tenth of a day instead of a full day.
You can see modified code below and it shows both matrix are equivalent: -
%development rates of each stage
dpreg = 0.172;
dprL1 = 0.217;
dprL2 = 0.313;
dprL3 = 0.222;
dprL4 = 0.135;
dprPu = 0.099;
%relative mortality rates of each stage
rmreg = 0.017;
rmrL1 = 0.060;
rmrL2 = 0.032;
rmrL3 = 0.022;
rmrL4 = 0.020;
rmrPu = 0.020;
rmrAd = 0.027;
B1 = [1-(dpreg+rmreg),0,0,0,0,0,0;
dpreg,1-(dprL1+rmrL1),0,0,0,0,0;
0,dprL1,1-(dprL2+rmrL2),0,0,0,0;
0,0,dprL2,1-(dprL3+rmrL3),0,0,0;
0,0,0,dprL3,1-(dprL4+rmrL4),0,0;
0,0,0,0,dprL4,1-(dprPu+rmrPu),0;
0,0,0,0,0,dprPu,1-rmrAd];
A = [10;10;10;10;10;10;10];
%%this loop can be used to calculate the result for 10 days to check whether it is the same %result, to do so change the 1:1 to 1:10
for i = 1:1
C = B1*A;
A=C;
end
disp(A);
%Converting transition matrix
A = [10;10;10;10;10;10;10];
B2=B1^(0.1);
for i = 1:10
C = B2*A;
A=C;
end
disp(A);
0 Comments
More Answers (0)
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!