Question: function [P1,P2,P3,P4]= Demographics_1_fcn(parameters,initconds,timedata) % P1-4, age to 1->2 2->3 3->4 t(initialgroup)(finalgroup) % BR birth of group P2 % d1-d4 death of P1-4 % initconds =

function [P1,P2,P3,P4]= Demographics_1_fcn(parameters,initconds,timedata)

% P1-4, age to 1->2 2->3 3->4 t(initialgroup)(finalgroup)

% BR birth of group P2

% d1-d4 death of P1-4

% initconds = [initial population 1-4]

% timedata = [starttime, endtime, change in time]

% result = [P1,P2,P3,P4] in vector

BR = parameters(1);

DR = parameters(2:5);

Tran = parameters(6:8);

tinit = timedata(1);

tfinal = timedata(2);

tdelta = timedata(3);

P1(1) = initconds(1);

P2(2) = initconds(2);

P3(3) = initconds(3);

P4(4) = initconds(4);

time = tinit:tdelta:tfinal;

for i = 1:length(time) - 1

P2temp = P2(i)

P2(i+1) = P1(i) - P1(i)*DR(1)

P3(i+1) = P2(i) - P2(i)*DR(2)

P4(i+1) = P3(i) - P3(i)*DR(3) + P4(i) - P4(i)*DR(4)

P1(i+1) = P2temp * BR

end

end

Error I get is "Variable P1 must be of size [201 1]. It is currently of size [1 201]" for P1 to P4.

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!