当我尝试使用dsolve
进行符号解决时,它无法找到明确的解决方案:
T = 5;
r = 0.005;
dsolve(
'Dp11 = p12^2/r - 4*p12 - 2',
'Dp12 = p12 - p11 - 2*p22 + (p12*p22)/r',
'Dp22 = 2*p22 - 2*p12 + p22^2/r',
'Dg1 = g2*(p12/r - 2) - 1',
'Dg2 = g2*(p22/r + 1) - g1',
'p11(T)=1',
'p12(T)=0',
'p22(T)=0',
'g1(T)=0.5',
'g2(T)=0')
syms x1 x2
x = [x1; x2];
u = -inv(R)*B'*(P*x - g)
u = -(p12*x1 - g2 + p22*x2)/r
dsolve(
'Dp11 = p12^2/r - 4*p12 - 2',
'Dp12 = p12 - p11 - 2*p22 + (p12*p22)/r',
'Dp22 = 2*p22 - 2*p12 + p22^2/r',
'Dg1 = g2*(p12/r - 2) - 1',
'Dg2 = g2*(p22/r + 1) - g1')
T = 5;
r = 0.005;
dsolve('Dp11 = p12^2/0.005 - 4*p12 - 2','Dp12 = p12 - p11 - 2*p22 + (p12*p22)/0.005','Dp22 = 2*p22 - 2*p12 + p22^2/0.005','Dg1 = g2*(p12/0.005 - 2) - 1','Dg2 = g2*(p22/0.005 + 1) - g1')
dsolve('Dp11 = p12^2/0.005 - 4*p12 - 2','Dp12 = p12 - p11 - 2*p22 + (p12*p22)/0.005','Dp22 = 2*p22 - 2*p12 + p22^2/0.005','Dg1 = g2*(p12/0.005 - 2) - 1','Dg2 = g2*(p22/0.005 + 1) - g1','p11(5)=1','p12(5)=0','p22(5)=0','g1(5)=0.5','g2(5)=0')
然后我尝试以下方法来解决和绘制图形,但以下内容无法解决
按ode45, failure at t = 2.39e-001 Unable to meet integration tolerances without reducing the step size below the smallest value allowed (4.44e-016) at time t
然后我尝试y0 = [0 0 0 0 0]
它可以解决但是它不是终端条件。我该怎么解决这个问题?
t0 = 0;
tf = 5;
y0 = [1 0 0 0.5 0];
[X, Y] = ode45(@exampleode, [t0 tf], y0);
function dy = exampleode(t, y)
r = 0.005;
dy = zeros(5, 1);
dy(1) = y(2)^2/r - 4*y(2) - 2;
dy(2) = y(2) - y(1) - 2*y(3) + (y(2)*y(3))/r;
dy(3) = 2*y(3) - 2*y(2) + y(3)^2/r;
dy(4) = y(5)*(y(2)/r - 2) - 1;
dy(5) = y(5)*(y(3)/r + 1) - y(4);
答案 0 :(得分:1)
dsolve在解决线性微分方程方面很不错。你的问题是你在它上面抛出一个非线性差分,这似乎是它可以处理的更多。 看看这种方式:对于五次多项式方程没有通用解:每个解都必须在数值上找到。
重新解决你的第二个问题,不确定你是否接受了这个问题,但你的等式非常不稳定!
[X, Y] = ode45(@exampleode, [t0 0.238], y0);
plot (X,Y)