Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

dO PART 2 USING MATLAB PART 1 Create arrays in MATLAB containing the data on growth of paramecium given in the table below. Call the

dO PART 2 USING MATLAB

PART 1

Create arrays in MATLAB containing the data on growth of paramecium given in the table below. Call the array with the days n and the array with the density Pdata. Type figure(1) and make a plot of the data showing the mean density as a function of days. Show the data points as filled blue circles (not points). See the MATLAB Documentation on Line Specification (LineSpec) for information on how to control the properties of marker symbols.

Day (n) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

Mean density of paramecium (Pn) 14, 34 , 56, 94, 189, 266, 330, 416, 507, 580, 610, 513, 593, 557, 560, 522, 565, 517, 500, 585, 500, 495 525, 510

B) Create an array containing the change in mean density from day to day. Calculate this as Pn = Pn+1 Pn using the MATLAB diff command and call the resulting array deltaPdata. Now create an array to model this change using the expression Pn = Pn (N Pn), for n = 1 to 23 with N = 525 .Call this array deltaPmodel. Type figure(2) and make a plot showing deltaPmodel versus deltaPdata. Show these points as filled black circles. Now fit a line to this data using the MATLAB backslash operator to perform least squares regression:

k= transpose (delta Pmodel)/ transpose(delta Pdata)

what is the value of k?

C) Add a red line to figure(2) showing your fit to these data points:

figure(2)

hold on

plot(deltaPmodel,k*deltaPmodel,r,Linewidth,2)

. D) Now simulate your difference equation model: Pn+1 = Pn + kPn(N Pn) by iterating the map. (Hint: initialize an array called Pmodel and set Pmodel(1) to your initial condition. Write a for loop to iterate through days 2 through 24, and on each iteration i update Pmodel(i) using the difference equation model.)

E) Add filled red circles to figure(1) showing how well your model agrees with the data:

figure(1)

hold on

plot(n,Pmodel,ro,MarkerFaceColor,r,

PART 2

The logistic map is given by: Xn+1 = R*Xn(1 - Xn) (1) where r > 0 and initial condition 0 < x0 < 1. The main goal of this part of the lab is to create a cobweb diagram. The following is a suggested pseudo-code for plotting the cobweb diagram. ------------------------------------------------------------- Initialize array_x to be a vector of size N. Initialize r, x_0, and let array_x(1) = x_0. for i = 1:N implement equation (1) end plot a straight line x=y plot the curve y = rx(1-x) for j = 1:N plot a vertical line from (x_array(j), x_array(j) to (x_array(j), x_array(j+1)) plot a horizontal line from (x_array(j), x_array(j+1)) to (x_array(j+1), x_array(j+1)) end label x_axis to be `x_n' and y_axis to be `x_{n+1}'. give an appropriate title for the plot. ------------------------------------------------------------- After you complete the program, answer the following questions. For each of the following cases, make two plots: (1) xn versus n, and (2) a cobweb diagram. For each case, nd the xed point and describe the behavior of solution. (a) r = 1:5 (b) r = 3 (c) r = 4

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

Database 101

Authors: Guy Kawasaki

1st Edition

0938151525, 978-0938151524

More Books

Students also viewed these Databases questions

Question

Why do HCMSs exist? Do they change over time?

Answered: 1 week ago