Note: Rabbit Fox problem is a predator prey problem Here is the MATLAB code ment
ID: 3865679 • Letter: N
Question
Note: Rabbit Fox problem is a predator prey problem
Here is the MATLAB code mentioned in the problem statement, that needs to be modified!!!
3. (a) Edit the AdBa3.m function so that it's able to solve systems of differential equa- tions. (b) Consider the Rabbit-Fox problem R'(t) = 2R(t)-R(t)F(t) F'(t) = 2R(t)F(t)-2F(t) over 0 t 20 with R(0) = 3, F(0) = 2, Solve this problem using the function you wrote in (a) with step-sizes h = 20/2k for k = 8,9, , 16 and estimate the order of convergence as in 1(e) using both the R) and F() valuesExplanation / Answer
(a)
Given u(1) = ya;
To solve the systems of differental equation we need to change the flow of control inside for(calculation) loop.
[urk, ~] = rungek4 (f, a, T(3), h, ya);
u(1:3) = urk;
for i= 3:n
k_1 = T(a(i),u(i));
k_2 = T(a(i)+0.5*h,u(i)+0.5*h*k_1);
k_3 = T((a(i)+0.5*h),(u(i)+0.5*h*k_2));
k_4 = T((a(i)+h),(u(i)+k_3*h));
...............................................
-------------------------------------------
u(i+1) = u(i) + (1/6)*(k_1+2*k_2+2*k_3+k_4)*h; % main equation
end
(b)
The initial rabbit population is 3, the initial fox population is 2:
R(0) = 3
F(0) = 2
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.