matlab微分方程组求解方程组:dx/dt=-2Ax+uydy/dt=2Ax+auz-(A+u)yx+y+z=1matlab求解如下:>>global A,u>>[x,y,z]=dsolve('Dx=(-2)*A*x+u*y','Dy=2*A*x+2*u*z-(A+u)*y','x+y+z=1','x(0)=1,y(0)=0,z(0)=0')结果出错:Error using ==> dsolveThere are more ODEs than variables.为什么会出错?
matlab微分方程组求解
方程组:dx/dt=-2Ax+uy
dy/dt=2Ax+auz-(A+u)y
x+y+z=1
matlab求解如下:
>>global A,u
>>[x,y,z]=dsolve('Dx=(-2)*A*x+u*y','Dy=2*A*x+2*u*z-(A+u)*y','x+y+z=1','x(0)=1,y(0)=0,z(0)=0')
结果出错:
Error using ==> dsolve
There are more ODEs than variables.
为什么会出错?
a小写??
把第三个式子也微分.
>> [x,y,z]=dsolve('Dx=(-2)*A*x+u*y','Dy=2*A*x+2*u*z-(A+u)*y','Dx+Dy+Dz=0','x(0)=1,y(0)=0,z(0)=0')
x =
u^2/(A^2+2*u*A+u^2)+2*u*A/(A^2+2*u*A+u^2)*exp(-(A+u)*t)+A^2/(A^2+2*u*A+u^2)*exp(-2*(A+u)*t)
y =
-(-2*u*A^2/(A^2+2*u*A+u^2)*exp(-(A+u)*t)+2*u^2*A/(A^2+2*u*A+u^2)*exp(-(A+u)*t)+2*A^2/(A^2+2*u*A+u^2)*exp(-2*(A+u)*t)*u-2*A*u^2/(A^2+2*u*A+u^2))/u
z =
(-2*u^2*A^2/(A^2+2*u*A+u^2)*exp(-(A+u)*t)+A^2/(A^2+2*u*A+u^2)*exp(-2*(A+u)*t)*u^2+A^2*u^2/(A^2+2*u*A+u^2))/u^2
>> test=x+y+z
test =
u^2/(A^2+2*u*A+u^2)+2*u*A/(A^2+2*u*A+u^2)*exp(-(A+u)*t)+A^2/(A^2+2*u*A+u^2)*exp(-2*(A+u)*t)-(-2*u*A^2/(A^2+2*u*A+u^2)*exp(-(A+u)*t)+2*u^2*A/(A^2+2*u*A+u^2)*exp(-(A+u)*t)+2*A^2/(A^2+2*u*A+u^2)*exp(-2*(A+u)*t)*u-2*A*u^2/(A^2+2*u*A+u^2))/u+(-2*u^2*A^2/(A^2+2*u*A+u^2)*exp(-(A+u)*t)+A^2/(A^2+2*u*A+u^2)*exp(-2*(A+u)*t)*u^2+A^2*u^2/(A^2+2*u*A+u^2))/u^2
>> simplify(test)
ans =
1