我相求这么一个方程组,现在的代码是这么写的:
主程序:syms c1 c2 c3 c4 r
c = [c1,c2,c3,c4];
digits(4)
es = c1*x_0(:,1)+c2*x_0(:,2)+c3*x_0(:,3)+c4*x_0(:,4);
yy = vpa(dot(AA*c',c)/dot(BB*c',c));
y = vpa(sum(es.^2));
L = yy+r*(y-1);
L1=diff(L,c1);
L2=diff(L,c2);
L3=diff(L,c3);
L4=diff(L,c4);
Lr=diff(L,r);
x0 = rand(5,1);
x=vpa(fsolve('func',x0,optimset('Display','off')));
ess = x(1)*x_0(:,1)+x(2)*x_0(:,2)+x(3)*x_0(:,3)+x(4)*x_0(:,4);
func函数是这样的
function q = func( p )
c1 = p(1);c2 = p(2);c3 = p(3);c4 = p(4);r = p(5);
q(1)=- r*(2.274e-13*c2 - 2.0*c1 + 1.819e-12*c3) - (1.0*(7.323e-20*c1 + 3.48e-20*c2 - 1.943e-20*c3 + 7.162e-20*c4))/(c2*(2.906e-17