Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please use MATLAB to solve this problem. Case 2: Steady State Model Find the initial values for rabbit and fox population (rss,fss) that result in
Please use MATLAB to solve this problem.
Case 2: Steady State Model Find the initial values for rabbit and fox population (rss,fss) that result in a non-zero steady-state condition. Use (rss,fss) as initial conditions and show you get the proper response. You will likely need to work this on paper (manipulating equations) before coding. Equations to use for steady state: dr/dt = 0 = GRR*r -(EFR*f)*r df/dt = 0) = GRF*f +(ERF*r)*f O O O O Inputs parameters= (GRR,EFR, GRF, ERF] GRR, growth rate of rabbits EFR, effect of foxes on rabbit increase GRF, growth rate of foxes ERF, effect of rabbits on fox increase timedata= [tinit,tfinal,delt] tinit, time at the start of the model run tfinal, time at the end of the model run delt, the size of the time step in Euler's method Outputs rss,fss rabbit and fox initial conditions that give steady state rvec,fvec rabbit and fox histories, using rss, fss as initial conditions O O O Function Setup function (rss,fss,rvec,fvec]= PredatorPrey_2_fcn(parameters,timedata) % Your code here end Test Case 2 O solutions submitted (max: 4) Enter your function from Test Case 2 into the space below. Click the run button to test your code output using the provided script Click the submit button to have your work assessed. You have a 4 submission limit. Function C Reset MATLAB Documentation 1 function [rss, fss, rvec, fvec]=PredatorPrey_2_fcn (parameters, timedata) 2 % Copy and paste your code here 3 4 end Code to call your function C Reset 1 % Below is a script that will execute and plot your function for some given sample parameters. 2 % Try adjusting the parameters to see if the model behaves as you would predict 3 GRR= 0.4; 4 EFR= 0.032; 5 GRF= -1.0; 6 ERF= 0.02; 7 tinit= 0.; 8 tfinal= 60.; 9 delt= 0.05; 10 11 parameters2= [GRR, EFR, GRF, ERF]; 12 timedata2= [tinit,tfinal, delt]; 13 [rss, fss,rvec, fvec)= PredatorPrey_2_fcn (parameters2, timedata2); 14 15 hold on 16 plot(rvec) 17 plot(fvec, 'r') 18 xlabel('step #') 19 ylabel('population') 20 legend ('rvec','fvec') 21 hold off Case 2: Steady State Model Find the initial values for rabbit and fox population (rss,fss) that result in a non-zero steady-state condition. Use (rss,fss) as initial conditions and show you get the proper response. You will likely need to work this on paper (manipulating equations) before coding. Equations to use for steady state: dr/dt = 0 = GRR*r -(EFR*f)*r df/dt = 0) = GRF*f +(ERF*r)*f O O O O Inputs parameters= (GRR,EFR, GRF, ERF] GRR, growth rate of rabbits EFR, effect of foxes on rabbit increase GRF, growth rate of foxes ERF, effect of rabbits on fox increase timedata= [tinit,tfinal,delt] tinit, time at the start of the model run tfinal, time at the end of the model run delt, the size of the time step in Euler's method Outputs rss,fss rabbit and fox initial conditions that give steady state rvec,fvec rabbit and fox histories, using rss, fss as initial conditions O O O Function Setup function (rss,fss,rvec,fvec]= PredatorPrey_2_fcn(parameters,timedata) % Your code here end Test Case 2 O solutions submitted (max: 4) Enter your function from Test Case 2 into the space below. Click the run button to test your code output using the provided script Click the submit button to have your work assessed. You have a 4 submission limit. Function C Reset MATLAB Documentation 1 function [rss, fss, rvec, fvec]=PredatorPrey_2_fcn (parameters, timedata) 2 % Copy and paste your code here 3 4 end Code to call your function C Reset 1 % Below is a script that will execute and plot your function for some given sample parameters. 2 % Try adjusting the parameters to see if the model behaves as you would predict 3 GRR= 0.4; 4 EFR= 0.032; 5 GRF= -1.0; 6 ERF= 0.02; 7 tinit= 0.; 8 tfinal= 60.; 9 delt= 0.05; 10 11 parameters2= [GRR, EFR, GRF, ERF]; 12 timedata2= [tinit,tfinal, delt]; 13 [rss, fss,rvec, fvec)= PredatorPrey_2_fcn (parameters2, timedata2); 14 15 hold on 16 plot(rvec) 17 plot(fvec, 'r') 18 xlabel('step #') 19 ylabel('population') 20 legend ('rvec','fvec') 21 hold offStep 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