Question
Create a function that projects population based on static: Birth Rate (BR) Death Rate (DR) Annual Migration (Mann) A template for the function has been
Create a function that projects population based on static:
Birth Rate (BR)
Death Rate (DR)
Annual Migration (Mann)
A template for the function has been provided. Please do not change variable names as this will result in an incorrect answer.
FUNCTION
function [P]=popDynamics_1_fcn(BR,DR,tinit,tfinal,delt,Pinit,Mann)
% -------------------------------------------------------------------------
% Case 1. M(t) is constant. Find P(t) history.
% SETUP
% tinit,tfinal,delt: time period of interest; delt, step size
% BR, birth rate
% DR, death rate
% Mann, annual rate of migration (+:immigration, -:emigration)
% Pinit, initial population level
% RESULTS
% P, population history
% -------------------------------------------------------------------------
% find nsteps and set up output data
t=tinit:delt:tfinal;
P=((BR-DR)+Mann)*t+Pinit-((BR-DR)+Mann)*tinit; %this is my code I am not sure what is wrong with this function
end
CODE TO CALL YOUR FUNCTION
BR=.15;
DR=.09;
tinit=0;
tfinal=100;
delt=.5;
Pinit=400;
Mann=-10;
[P]=popDynamics_1_fcn(BR,DR,tinit,tfinal,delt,Pinit,Mann);
t=tinit:delt:tfinal;
plot(t,P)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started