求解具有7个未知数的微分方程

时间:2015-07-07 08:46:06

标签: matlab differential-equations

我想解决7个微分方程,它们是7个未知数的时间函数。 我想找到方程的解决方案:

eo(t)=f1(e_0(t),e_1(t),e_2(t),e_3(t),w_1(t),w_2(t),w_3(t))
e1(t)=f2(e_0(t),e_1(t),e_2(t),e_3(t),w_1(t),w_2(t),w_3(t))
e2(t)=f3(e_0(t),e_1(t),e_2(t),e_3(t),w_1(t),w_2(t),w_3(t))
e3(t)=f4(e_0(t),e_1(t),e_2(t),e_3(t),w_1(t),w_2(t),w_3(t))
w1(t)=f5(e_0(t),e_1(t),e_2(t),e_3(t),w_1(t),w_2(t),w_3(t))
w2(t)=f6(e_0(t),e_1(t),e_2(t),e_3(t),w_1(t),w_2(t),w_3(t))
w3(t)=f7(e_0(t),e_1(t),e_2(t),e_3(t),w_1(t),w_2(t),w_3(t))

我已经生成了e0, e1, e2, e3, w1, w2, w3的方程式。 现在,我该如何解决这些方程式,以及需要哪些命令?

我需要找到e0, e1, e2, e3, w1, w2, w3的值,并根据t获取这些值。

必须解决的方程是

e0 = - (e_1(t)*w_1(t))/2 - (e_2(t)*w_2(t))/2 - (e_3(t)*w_3(t))/2
e1 = (e_0(t)*w_1(t))/2 - (e_2(t)*w_3(t))/2 - (e_3(t)*w_2(t))/2
e2 =(e_0(t)*w_2(t))/2 - (e_1(t)*w_3(t))/2 + (e_3(t)*w_1(t))/2
e3 = (e_0(t)*w_3(t))/2 + (e_1(t)*w_2(t))/2 - (e_2(t)*w_1(t))/2
w1 = w_2(t)*(1.98019*e_3(t)*(e_1(t)*w_1(t) + e_2(t)*w_2(t) + e_3(t)*w_3(t)) + 1.980*e_0(t)*(e_0(t)*w_3(t) + e_1(t)*w_2(t) - 1.0*e_2(t)*w_1(t)) - 1.980*e_1(t)*(e_0(t)*w_2(t) - 1.0*e_1(t)*w_3(t) + e_3(t)*w_1(t)) - 1.9801*e_2(t)*(e_2(t)*w_3(t) - 1.0*e_0(t)*w_1(t) + e_3(t)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0(t)*(e_2(t)*w_3(t) - 1.0*e_0(t)*w_1(t) + e_3(t)*w_2(t)) - 1.980*e_1(t)*(e_1(t)*w_1(t) + e_2(t)*w_2(t) + e_3(t)*w_3(t)) + 1.980*e_2(t)*(e_0(t)*w_3(t) + e_1(t)*w_2(t) - 1.0*e_2(t)*w_1(t)) + 1.980*e_3(t)*(e_0(t)*w_2(t) - 1.0*e_1(t)*w_3(t) + e_3(t)*w_1(t))) - 1.0*w_3(t)*(1.0*e_0(t)*(e_1(t)*w_1(t) + e_2(t)*w_2(t) + e_3(t)*w_3(t)) + 1.0*e_1(t)*(e_2(t)*w_3(t) - 1.0*e_0(t)*w_1(t) + e_3(t)*w_2(t)) - 1.0*e_2(t)*(e_0(t)*w_2(t) - 1.0*e_1(t)*w_3(t) + e_3(t)*w_1(t)) - 1.0*e_3(t)*(e_0(t)*w_3(t) + e_1(t)*w_2(t) - 1.0*e_2(t)*w_1(t))) + (63.366*kappa^2*(0.3551*kappa*((e_0(t)^2 + e_1(t)^2 - 1.0*e_2(t)^2 - 1.0*e_3(t)^2)*(e_0(t)^2 - 1.0*e_1(t)^2 + e_2(t)^2 - 1.0*e_3(t)^2) - 1.0*(2.0*e_0(t)*e_3(t) + 2.0*e_1(t)e_2(t))(2.0*e_0(t)*e_3(t) - 2.0*e_1(t)*e_2(t))) - 0.724*w_3(t) + 0.362*kappa*((e_0(t)^2 + e_1(t)^2 - 1.0*e_2(t)^2 - 1.0*e_3(t)^2)*(e_0(t)^2 - 1.0*e_1(t)^2 + e_2(t)^2 - 1.0*e_3(t)^2) + (2.0*e_0(t)*e_3(t) + 2.0*e_1(t)e_2(t))(2.0*e_0(t)*e_3(t) - 2.0*e_1(t)*e_2(t)))))/(l^5*rho)

在分配值

后,我在MATLAB中使用了这段代码
soll=ode45(e0,e1,e2,e3,w1,w2,w3,e_0(t),e_1(t),e_2(t),e_3(t),w_1(t),w_2(t),w_3(t))

但是我收到以下错误消息:

  

未定义的功能'存在'对于输入参数类型为' sym'。

     

odearguments(第59行)中的错误if(exists(ode)== 2)

     

ode45中的错误(第113行)[neq,tspan,ntspan,next,t0,tfinal,tdir,y0,f0,odeArgs,odeFcn,...

请告诉我哪里出错了。

1 个答案:

答案 0 :(得分:0)

此错误表示ode45无法解决符号方程(您的变量属于' sym')。实际上ode45是一个数值解算器,它在函数上工作,而不是符号表达式。以下是define a function in Matlab

的方法
  

首先,您需要创建一个新的m文件,然后键入此代码

function y = f(x)
y = 2 * (x^3) + 7 * (x^2) + x;
  

使用文件名保存' f.m'