如何在Matlab中求解微分方程组

时间:2015-03-02 04:00:59

标签: matlab linear ode differential-equations

对于家庭作业,我的教授要求我们使用matlab解决微分方程组。使用mathworks网站,我做了

syms f(t) g(t) h(t)
[f(t), g(t), h(t)] = dsolve(diff(f) == .25*g*h,...
diff(g) == -2/3*f*h,...
diff(h) == .5*f*g, f(0) == 1, g(0) == -2, h(0) == 3)

它表示无法解决明确的等式...感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

%x(1),x(2),x(3)=f,g,h

fun = @(t,x) [0.25*x(2)*x(3); -2/3*x(1)*x(3);
-0.5*x(1)*x(2)];
[t,x] = ode45(fun,[0 100],[1 2 3]);
plot3(x(:,1),x(:,2),x(:,3))
%x has three columns which contains values of f,g,h as a function of time from %time t=0 to t=100
%please check ode45 in matlab to see what these arguments mean
相关问题