微分方程is not easily solved analytically的這種非線性系統。您可以嘗試Mathematica如果有的話(它往往是在符號數學比MATLAB的MuPad越好):
DSolve[{a'(t) = -k*d(t)*a(t)*b(t)^2, b'(t) = -k*f(t)*b(t)*c(t)^2, c'(t) = k*d(t)*a(t)*b(t)^2 - k*e(t)*a(t)*d(t), d'(t) = k*d(t)*a(t)*b(t)^2, e'(t) = -k*e(t)*a(t)*d(t), f(t) = k*f(t)*b(t)*c(t)^2}, {a(t),b(t),c(t),d(t),e(t),f(t)}, t]
(我不能對此進行測試,因爲輸入過長的Wolfram|Alpha免費版本:)
不管怎麼說,這是很容易做到數字它MATLAB:
function top
%// Initial values (random for this example)
y0 = 125*randn(6,1);
%// Time span to simulate
tspan = [0 +1];
%// Solve system numerically
[t,y] = ode45(@deriv, tspan, y0);
%// Make a nice plot
plot(t,y)
xlabel('t'), ylabel('function values')
legend('a(t)', 'b(t)', 'c(t)', 'd(t)', 'e(t)', 'f(t)')
end
function dydt = deriv(~,y)
%// Set the value for your 'k'
k = 1e-4;
%// rename the variables for clarity
[a,b,c,d,e,f] = deal(y(1),y(2),y(3),y(4),y(5),y(6));
%// Compute the derivative
dydt = k * [
-d*a*b^2
-f*b*c^2
+a*(d*b^2 - e*d)
+d*a*b^2
-e*a*d
+f*b*c^2
];
end
其中funkier解決方案,我用這個得了的:
出於好奇:做這些方程描述?我想說的經歷化學反應物質的濃度,但它會是非常奇怪的(對於一些初始值,你會發現負濃度,奇異等,東西你只是不會在這些系統中期望,所以...我的好奇心被觸發:)
...你爲什麼感到驚訝?你有一些關於微分方程的類嗎? –
我假設'kd','kf'等是指'k * d'和'k * f'? –
對不起,他們只是常數... kd = .25; ke = .1; kf = 5,我正在與化學rxn和率法律... – Prefoninsane