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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!