Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Demystifying Databases A Hands On Guide For Database Management

Authors: Shiva Sukula

1st Edition

8170005345, 978-8170005346

More Books

Students also viewed these Databases questions