怎样用matlab接下面的多元二次方程组 或用其他工具也行
7*n1^2+290*n7-3*n7^2=58877*n2^2-10*n1*n2+3*n1^2+290*n7-3*n7^2=58877*n3^2-10*n2*n3+3*n...
7*n1^2+290*n7-3*n7^2=5887
7*n2^2-10*n1*n2+3*n1^2+290*n7-3*n7^2=5887
7*n3^2-10*n2*n3+3*n2^2+290*n7-3*n7^2=5887
7*n4^2-10*n3*n4+3*n3^2+290*n7-3*n7^2=5887
7*n5^2-10*n4*n5+3*n4^2+290*n7-3*n7^2=5887
7*n6^2-10*n5*n6+3*n5^2+290*n7-3*n7^2=5887
4*n7^2-10*n6*n7+3*n6^2+290*n7=5887 展开
7*n2^2-10*n1*n2+3*n1^2+290*n7-3*n7^2=5887
7*n3^2-10*n2*n3+3*n2^2+290*n7-3*n7^2=5887
7*n4^2-10*n3*n4+3*n3^2+290*n7-3*n7^2=5887
7*n5^2-10*n4*n5+3*n4^2+290*n7-3*n7^2=5887
7*n6^2-10*n5*n6+3*n5^2+290*n7-3*n7^2=5887
4*n7^2-10*n6*n7+3*n6^2+290*n7=5887 展开
2个回答
展开全部
建立.m文件
function F=myfun(x)
n1=x(1);
n2=x(2);
n3=x(3);
n4=x(4);
n5=x(5);
n6=x(6);
n7=x(7);
f1=7*n1^2+290*n7-3*n7^2-5887;
f2=7*n2^2-10*n1*n2+3*n1^2+290*n7-3*n7^2-5887;
f3=7*n3^2-10*n2*n3+3*n2^2+290*n7-3*n7^2-5887;
f4=7*n4^2-10*n3*n4+3*n3^2+290*n7-3*n7^2-5887;
f5=7*n5^2-10*n4*n5+3*n4^2+290*n7-3*n7^2-5887;
f6=7*n6^2-10*n5*n6+3*n5^2+290*n7-3*n7^2-5887';
f7=4*n7^2-10*n6*n7+3*n6^2+290*n7-5887;
F=[f1,f2,f3,f4,f5,f6,f7]';
---------------
options=optimset('maxfuneval',1000);
[x,fval,exitflag,output]=fsolve(@myfun,[1 1 1 1 1 1 1],options)
Equation solved.
fsolve completed because the vector of function values is near zero
as measured by the default value of the function tolerance, and
the problem appears regular as measured by the gradient.
<stopping criteria details>
x =
6.3729 11.1800 15.1144 18.4942 21.4887 24.1984 26.6875
fval =
1.0e-009 *
0.1055
0.0018
0.0146
-0.0018
0.0036
0.0055
-0.0018
exitflag =
1
output =
iterations: 9
funcCount: 80
algorithm: 'trust-region dogleg'
firstorderopt: 1.6297e-008
message: [1x695 char]
function F=myfun(x)
n1=x(1);
n2=x(2);
n3=x(3);
n4=x(4);
n5=x(5);
n6=x(6);
n7=x(7);
f1=7*n1^2+290*n7-3*n7^2-5887;
f2=7*n2^2-10*n1*n2+3*n1^2+290*n7-3*n7^2-5887;
f3=7*n3^2-10*n2*n3+3*n2^2+290*n7-3*n7^2-5887;
f4=7*n4^2-10*n3*n4+3*n3^2+290*n7-3*n7^2-5887;
f5=7*n5^2-10*n4*n5+3*n4^2+290*n7-3*n7^2-5887;
f6=7*n6^2-10*n5*n6+3*n5^2+290*n7-3*n7^2-5887';
f7=4*n7^2-10*n6*n7+3*n6^2+290*n7-5887;
F=[f1,f2,f3,f4,f5,f6,f7]';
---------------
options=optimset('maxfuneval',1000);
[x,fval,exitflag,output]=fsolve(@myfun,[1 1 1 1 1 1 1],options)
Equation solved.
fsolve completed because the vector of function values is near zero
as measured by the default value of the function tolerance, and
the problem appears regular as measured by the gradient.
<stopping criteria details>
x =
6.3729 11.1800 15.1144 18.4942 21.4887 24.1984 26.6875
fval =
1.0e-009 *
0.1055
0.0018
0.0146
-0.0018
0.0036
0.0055
-0.0018
exitflag =
1
output =
iterations: 9
funcCount: 80
algorithm: 'trust-region dogleg'
firstorderopt: 1.6297e-008
message: [1x695 char]
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询