Transitionmatrix needs to be converted from day to one tenth of a day.

3 次查看(过去 30 天)
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

采纳的回答

Rohit
Rohit 2023-4-18
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);
8.1100 8.9500 8.7200 10.6900 10.6700 10.1600 10.7200
%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);
8.1100 8.9500 8.7200 10.6900 10.6700 10.1600 10.7200

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

产品


版本

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by