>> A=[2 1 3;1 3 2];B=[5;10]
B =
5
10
>> X=lsqnonneg(A,B)
X =
0
2.8571
0.7143
>> A\B
ans =
0
2.8571
0.7143
>> p=[1 -7 10] %表示x^2-7x+10
p =
1 -7 10
>> r=roots(p)
r =
5
2
>> p=poly(r)%由根创建多项式
p =
1 -7 10
>> A=ones(3),poly(A)
A =
1 1 1
1 1 1
1 1 1
ans =
1.0000 -3.0000 -0.0000 -0.0000
>> d=eig(A),[v,d]=eig(A) %求方阵A的特征值d与特征向量
d =
-0.0000
-0.0000
3.0000
v =
0.4082 0.7071 0.5774
0.4082 -0.7071 0.5774
<