Question
USING MATLAB MATH MODELING CLASS DO PART 1 AND 2(NEED THE CODES) Create arrays in MATLAB containing the data on growth of paramecium given in
USING MATLAB MATH MODELING CLASS
DO PART 1 AND 2(NEED THE CODES)
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
2) 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?
3) 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)
. 4) 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.)
5) 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,
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