matlab - computing the eigenvalue, eigenvector, and the stability age structure.. Actually, I'm using matlab to compute the Leslie Matrices.
A=[0 1 5; .3 0 0 ; 0 .5 0] % Leslie matrix A = 0 1.0000 5.0000 0.3000 0 0 0 0.5000 0 % Calculate the eigenvalues and eigenvectors of A: [V,D]=eig(A) V = 0.9501 + 0.0000i 0.9270 + 0.0000i 0.9270 + 0.0000i 0.2800 + 0.0000i -0.1922 - 0.2609i -0.1922 + 0.2609i 0.1375 + 0.0000i -0.0559 + 0.1803i -0.0559 - 0.1803i D = 1.0182 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i -0.5091 + 0.6910i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i -0.5091 - 0.6910i StAgeStr = V(:,2)/(sum(V(:,2))) StAgeStr = 1.3465 + 0.1598i -0.2342 - 0.4121i -0.1124 + 0.2522i
B=[0 1 1; 2/3 0 0; 0 1/3 0] % Leslie Matrix B = 0 1.0000 1.0000 0.6667 0 0 0 0.3333 0 % Calculate the eigenvalues and eigenvectors of A: [V,D]=eig(B) V = -0.8021 + 0.0000i 0.5032 - 0.1002i 0.5032 + 0.1002i -0.5634 + 0.0000i -0.7069 + 0.0000i -0.7069 + 0.0000i -0.1979 + 0.0000i 0.4776 + 0.0951i 0.4776 - 0.0951i D = 0.9491 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i -0.4746 + 0.0945i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i -0.4746 - 0.0945i StAgeStr = V(:,2)/(sum(V(:,2))) StAgeStr = 1.8435 - 0.3317i -2.5802 - 0.0481i 1.7367 + 0.3797i
@dan815
StAgeStru is actually the Stable Age Structure..
what is a leslie matrix
I also saw in my example text file that I could use the following command: Note, for a complex eigenvalue lambda the command abs(lambda) gives its size. but I don't know how it works
In applied mathematics, the Leslie matrix is a discrete, age-structured model of population growth that is very popular in population ecology.
it's like a 3 x 3 matrix but solving for eigenvalues and eigenvectors remains the same.
your eigen values and eigen vectors are probably right
the questions I had were: % 3) For each of the following matrices, find the dominant eigenvalue % and the corresponding eigenvector, and the stable age structure % a) A=[0 1 5; .3 0 0 ; 0 .5 0] % Note, for a complex eigenvalue lambda the command abs(lambda) gives its size. % b) B=[0 1 1; 2/3 0 0; 0 1/3 0] so that's basically just inputing the matrices 1 by 1 Starting with % a) A=[0 1 5; .3 0 0 ; 0 .5 0] % Calculate the eigenvalues and eigenvectors of A: [V,D]=eig(A) and stability age structure StAgeStr = V(:,2)/(sum(V(:,2)))
and that's how I got all the stuff above *points up*
StAgeStr = V(:,2)/(sum(V(:,2))) why does this tell you stable age structture
ummmmm ._______.
% The "stable age structure" is the longterm fraction of the total % population represented by each stage: take the dominant eigenvector % and divide it by the sum of the entries in it
oh ok
wanna check another code? this one is for phase planes and plotting Juvie and Adult Populations
how come u didnt take the first eigen vector to be dominant
errr what?
the first eigen vector is a result of the dominant eigen value
so what should the command be?
OH! if I do the same thing but with 1 instead x.x
no i am asking you, how do you know which vector is the dominant eigen vector
is it not based of the dominant eigen value?
hold on it's in the
% Note that the "dominant" eigenvalue is D(2,2) and the corresponding % eigenvector is V(:,2)
?
is my code off or something? O_O
hmm the D one is the dominant eigenvalue and the V is the corresponding eigenvector?
the dominant eigen value is 1,1
how is it 1,1?
you mean this entry? 0.9491 + 0.0000i
yeah, isnt it the highest power
if u look at some stages for example D^2= [0.9..^2 0 0 0 (-0.4...+...i)^2 0 0 0 (-0.4..+...i)^2]
which eigen value will be playing the biggest role as the powers increase?
whoever has the highest value... so would the code be StAgeStr = V(:,2)/(sum(D(:,1))) ?
>> StAgeStr = V(:,2)/(sum(D(:,1))) StAgeStr = 0.9105 + 0.0000i -0.1888 - 0.2562i -0.0549 + 0.1771i hmm?
dont forget to make the 2, 1 in V too
and use V not D since u said u have to divide by eigen vector sum
okay listen, i think theres something wrong with ur eigen values actually
StAgeStr = V(:,2)/(sum(V(:,1))) gives me something like this >> StAgeStr = V(:,2)/(sum(V(:,1))) StAgeStr = 0.6779 + 0.0000i -0.1405 - 0.1908i -0.0409 + 0.1318i
ogm my bad!! i was looking at your 2nd matric not ur first
yeah I posted two remember. Matrix A was my first post and Matrix was my second post. I was wondering if I inputted them correctly because they seem so straight forward to tweak the code and apply what the example file gave
StAgeStr = V(:,1****)/(sum(V(:,1)))
>> StAgeStr = V(:,1****)/(sum(V(:,1))) StAgeStr = V(:,1****)/(sum(V(:,1))) | Error: Unexpected MATLAB operator.
Join our real-time social learning platform and learn together with your friends!