Please help solve a system of differential equation

2 ビュー (過去 30 日間)
Jayesh Jawandhia
Jayesh Jawandhia 2023 年 3 月 15 日
コメント済み: Torsten 2023 年 4 月 4 日
I have a system of differential equation in x,y with boundary conditions. I want to solve it analytically and numerically. The analytical solutions coming in the form of error functions. Can someone please help me find analytical and numerical solution for this, I have been trying for weeks now, really need to solve this for my thesis. Please help.

回答 (1 件)

Alan Stevens
Alan Stevens 2023 年 3 月 15 日
Here's a numerical approach:
First manipulate the equations
tspan = [0, 120];
ic = [80000, 0.001];
[t, xy] = ode45(@rate, tspan, ic);
x = xy(:,1); y = xy(:,2);
subplot(2,1,1)
plot(t,x),grid
xlabel('t'), ylabel('x')
subplot(2,1,2)
plot(t,y),grid
xlabel('t'), ylabel('y')
function dxydt = rate(~,xy)
a = 0.1; b = 0.2; c = -0.1; % Replace with desired values
x = xy(1); y = xy(2);
dxydt = [a-b+c*x*y; % eqn (3)
c*y*(1-y) - a*y/x]; % eqn (5)
end
  19 件のコメント
Jayesh Jawandhia
Jayesh Jawandhia 2023 年 4 月 4 日
Hope you are doing well. I have been reading up on these and your solution has been really helpful. I just had a follow-up. We are trying to find a better fit by making a and b as a function of t. I haven't been able to figure out how do I add these to my ode45 solver in Matlab just like what you did here.
Can you please help with this? For simplicity, I am assuming both a and b second order in t, i.e.:
a = mt^2+nt+r
b = pt^2+qt+s
Really thankful for all your help!
Torsten
Torsten 2023 年 4 月 4 日
What's the problem ?
function dxydt = rate(t,xy);
m = ...;
n = ...;
r = ...;
p = ...;
q = ...;
s = ...;
a = m*t^2+n*t+r;
b = p*t^2+q*t+s;
x = xy(1);
y = xy(2);
dxydt = [a-b+c*x*y;c*y*(1-y)-a*y/x];
end

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by