Question: Please use MATLAB to solve this problem. Case 4 Investigate the effects of introducing a grouse population. Grouse play the same ecological role as rabbits.




Please use MATLAB to solve this problem.
Case 4 Investigate the effects of introducing a grouse population. Grouse play the same ecological role as rabbits. Assume no food limitations for rabbits or grouse. Governing Equations dr/dt = GRR*r -(EFR*f)*r dg/dt = GRG*g-(EFG*f)*g df/dt = GRF*f +(ERF*r)*f +(EGF*g)*f . r, rabbits g, grouse f, foxes o O O O O O . Inputs parameters= ( GRR,EFR, GRG,EFG, GRF, ERF,EGF ] GRR, growth rate of rabbits EFR, effect of foxes on rabbit increase GRG, growth rate of grouse EFG, effect of foxes on grouse increase o GRF, growth rate of foxes ERF, effect of rabbits on fox increase EGF, effect of grouse on fox increase initconds= (rinit, finit) rinit, initial rabbit population finit, initial fox population 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 rvec, rabbit history gvec, grouse history fvec, fox history OO O O O Function Setup function [rvec,gvec,fvec ]= PredatorPrey_4_fcn(parameters, timedata,initconds) % Your code here end Test Case 4 O solutions submitted (max: 4) Enter your function from Test Case 4 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 DI MATLAB Documentation 1 function [ rvec, gvec, fvec ]= PredatorPrey_4_fcn (parameters, timedata, initconds) 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 GRR4= 0.4; 4 EFR4= 0.032; 5 GRG4= 0.4; 6 EFG4= 0.032; 7 GRF4= -1.0; 8 ERF4= 0.02; 9 EGF4= 0.02; 10 11 tinit= 0.; 12 tfinal= 60.; 13 delt= 0.05; 14 15 rinit4= 35; 16 ginit4= 25; 17 finit4= 20; 18 19 parameters4= [GRR4, EFR4, GRG4, EFG4, GRF4, ERF4, EGF4]; 20 initconds4= [rinit4,ginit4, finit4]; 21 timedata4= (tinit,tfinal, delt]; 22 [rvec, gvec, fvec)= Predator Prey_4_fcn(parameters4, timedata4, initconds 4); 23 23 24 hold on 25 plot(rvec) 26 plot(fvec, 'r') 27 plot(gvec,'g') 28 xlabel('step #') 29 ylabel('population') 30 legend ('rvec', 'fvec','gvec') 31 hold off Case 4 Investigate the effects of introducing a grouse population. Grouse play the same ecological role as rabbits. Assume no food limitations for rabbits or grouse. Governing Equations dr/dt = GRR*r -(EFR*f)*r dg/dt = GRG*g-(EFG*f)*g df/dt = GRF*f +(ERF*r)*f +(EGF*g)*f . r, rabbits g, grouse f, foxes o O O O O O . Inputs parameters= ( GRR,EFR, GRG,EFG, GRF, ERF,EGF ] GRR, growth rate of rabbits EFR, effect of foxes on rabbit increase GRG, growth rate of grouse EFG, effect of foxes on grouse increase o GRF, growth rate of foxes ERF, effect of rabbits on fox increase EGF, effect of grouse on fox increase initconds= (rinit, finit) rinit, initial rabbit population finit, initial fox population 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 rvec, rabbit history gvec, grouse history fvec, fox history OO O O O Function Setup function [rvec,gvec,fvec ]= PredatorPrey_4_fcn(parameters, timedata,initconds) % Your code here end Test Case 4 O solutions submitted (max: 4) Enter your function from Test Case 4 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 DI MATLAB Documentation 1 function [ rvec, gvec, fvec ]= PredatorPrey_4_fcn (parameters, timedata, initconds) 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 GRR4= 0.4; 4 EFR4= 0.032; 5 GRG4= 0.4; 6 EFG4= 0.032; 7 GRF4= -1.0; 8 ERF4= 0.02; 9 EGF4= 0.02; 10 11 tinit= 0.; 12 tfinal= 60.; 13 delt= 0.05; 14 15 rinit4= 35; 16 ginit4= 25; 17 finit4= 20; 18 19 parameters4= [GRR4, EFR4, GRG4, EFG4, GRF4, ERF4, EGF4]; 20 initconds4= [rinit4,ginit4, finit4]; 21 timedata4= (tinit,tfinal, delt]; 22 [rvec, gvec, fvec)= Predator Prey_4_fcn(parameters4, timedata4, initconds 4); 23 23 24 hold on 25 plot(rvec) 26 plot(fvec, 'r') 27 plot(gvec,'g') 28 xlabel('step #') 29 ylabel('population') 30 legend ('rvec', 'fvec','gvec') 31 hold off
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
