Question
write a function for the Matlab (use loop) In this problem you will be modelling a LotkaVolterra Predator-Prey model. It is comprised of a pair
write a function for the Matlab (use loop)
In this problem you will be modelling a LotkaVolterra Predator-Prey model. It is comprised of a pair of first-order, non-linear differential equations frequently used to describe the dynamics of biological systems in which two species interact, one as a predator and the other as a prey.
Consider the following difference equation which explains the relationship between the population of eagles and rabbits in Himalaya. En+1 = En + (a En b EnRn)/95 (1) Rn+1 = Rn + (c En+1Rn d Rn)/85 (2)
where E and R represent the population of eagles and rabbits respectively, n represents the generation number while a, b, c and d are the constants having positive values. The inputs to the function are: initial population of eagles E0, initial populatio of rabbits R0, number of generations k and values for constants a, b, c and d. The required output of the function are: vectors E and R containing populations of eagles and rabbits at each generation respectively, and the maximum populations Emax and Rmax of both eagles and rabbits respectively over k generations. Remember the first generation is considered as initial population provided as E0 and R0 and must be included in the output vectors E and R respectively.
The first line of the function must be
function [Emax,Rmax,E,R] = eaglesRabbits(E0,R0,k,a,b,c,d)
Include, as a comment in the second row of your function file: your full name and student number. The sample input and output to test your code is provided below (ignore the format and concentrate on matching the result values) >> [Emax,Rmax,E,R] = eaglesRabbits(20,30,950,2,0.18,0.19,4); Emax = 42.9445 Rmax = 30.0915 E = Array of [1x950] R = Array of [1x950]
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