PLease solve by USING MATLAB 14.7 Project: Dynamics of Population Survival Our g
ID: 3282330 • Letter: P
Question
PLease solve by USING MATLAB
14.7 Project: Dynamics of Population Survival Our goal is to determine the long term population trend of the African Okapi. We will consider three life stages of the Okapi: junvenile J (first year), subadult S (second year) and adult ? (third year) Suppose the following matrix represents the rate of survival between life stages, next .J Where t represents the survival rate of juveniles to subadults. A dorninant eigenvalue of a matrix A is an eigenvalue ?? of A such that lil > ???l for all eigenvalues ?? of A Question 1 a. Record the dominant eigenvalue of ? for the following values of t, 1-.18, .20, .22, .24, 25, .26, 28, .30 HINT: DO NOT RETYPE THE MATRIX A EACH TIME. Use your understanding of in- dexing to help you with this step. Output your solution to the command window (up to four decimal places) with a description of the output b. Of the values you used for t, which is the srnallest one for which ?? I? Output your answer to the command window. We will call this the "ritical value of tExplanation / Answer
Here is the required MATLAB Code -
tol = 1e-6; % Tolerance for calculation of eigenvalue
T = [0.18 0.20 0.22 0.24 0.25 0.26 0.28 0.30]; % Values of t
eigenvalues = zeros(size(T)); % Vector to store the eigenvalues
for i=1:length(T)
% For each value of the parameter
t = T(i); % Get value of t
A = [0 0 0.33; t 0 0; 0 0.71 0.94]; % The matrix A
x = rand(3,1); % Random Vector to start finding dominant eigenvalue
eigen = (x' * A * x) ./ (x' * x); % Get Eigenvalue
eigen_prev = eigen; % Stores previous eigenvalue for comparison
error = 10 * tol; % Set error = 10*tol to start iterations
while error > tol
x = A*x;
eigen = (x' * A * x) ./ (x' * x); % Get Eigenvalue
error = abs((eigen - eigen_prev) / eigen_prev); % Calculate Error
eigen_prev = eigen;
end
eigenvalues(i) = eigen;
end
% Print the Eigenvalues
fprintf("(a) The Dominant Eigenvalues are : ");
fprintf(" t value ");
for i=1:length(T)
fprintf("%.2f %.4f ", T(i), eigenvalues(i));
end
% Find values of t for which dominant eigenvalue > 0
index = eigenvalues > 1;
req_t = min( T(index) );
fprintf(" (b) Minimum t for which eigenvalue > 0 is %.4f ", req_t);
------
Here is the output -
(a) The Dominant Eigenvalues are :
t value
0.18 0.9836
0.20 0.9880
0.22 0.9923
0.24 0.9966
0.25 0.9987
0.26 1.0008
0.28 1.0050
0.30 1.0090
(b) Minimum t for which eigenvalue > 0 is 0.2600
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.