MATLAB编程出现问题,The expression to the left of the equals sign i
来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/11/08 12:45:20
MATLAB编程出现问题,The expression to the left of the equals sign is not a valid target for an a.
A=[1.82\x051.04\x050.27\x050.99\x050.79\x050.36\x050.24\x050.13\x050.28\x050.56\x050.75\x050.47\x050.05
57.97\x0553.32\x0563.18\x0543.36\x0549.34\x0548.98\x0542.31\x0540.81\x0537.92\x0556.49\x0548.5\x0553.69\x0515.96
47.51\x0538.79\x0535.4\x0535.16\x0532.66\x0534.42\x0535.95\x0534.11\x0533.4\x0535\x0535.48\x0532.1\x0531.58
3.78\x051.76\x050.97\x051.63\x051.49\x051.05\x050.94\x050.54\x050.38\x051.38\x051.41\x051.25\x050.08
2.41\x052.37\x051.25\x052.77\x052.7\x052.31\x051.21\x051.26\x052.13\x051.96\x051.89\x051.83\x050.62
85\x0598\x0541\x05118\x05120\x05144\x0521\x0532\x0534\x0535\x0553\x05157\x05106
8958\x056504\x052006\x056435\x057120\x054255\x052144\x051281\x051482\x051615\x052513\x052401\x052303
18.84\x0511.19\x057.03\x054.1\x0510.39\x056.67\x057.32\x055.46\x052.56\x0511.52\x0513.25\x053.67\x051
45234\x0513312\x054213\x0512460\x0518312\x059153\x054346\x053217\x053198\x058450\x055689\x057677\x05996
434085\x05229939\x0526111\x05144142\x05264419\x05102836\x0594792\x0513320\x0513889\x0582717\x0532678\x0544217\x053495
452219\x05171496\x0558629\x05320129\x05229353\x05180078\x0588311\x0538480\x0520000\x0583849\x0575575\x0525868\x0516455
1999.6\x051649.3\x05119.01\x05843.39\x054005.2\x05635.65\x0578.65\x0574.57\x05172.86\x05386.33\x05407.74\x05451.13\x0511.47
39.59\x0550.02\x0512.88\x0536.48\x0559.95\x0523.57\x056.3\x057.64\x056.91\x0526.66\x0532.75\x0514.61\x052.19
]'
A1=A([1 2 4 5],:)
A2=A([6 10 11 12],:)
A3=A([3 7 8 9 13],:)
n1=size(A1,1)
n2=size(A2,1)
n3=size(A3,1)
n=n1+n2+n3
k=3
p=13
f=p*(p+1)*(k-1)/2
d=(2*p^2+3*p-1)*(1/(n1-1)+1/(n2-1)+1/(n3-1)-1/(n-k))/(6*(p+1)*(k-1))
p1=n1/n
p2=n2/n
p3=n3/n
m1=mean(A1)
m2=mean(A2)
m3=mean(A3)
s1=cov(A1)
s2=cov(A2)
s3=cov(A3)
s=((n1-1)*s1+(n2-1)*s2+(n3-1)*s3)/(n-k)
M=(n-k)*log(det(s))-((n1-1)*log(det(s1))+(n2-1)*log(det(s2))+(n3-1)*log(det(s3)))
T=(1-d)*M
C=chi2inv(0.95,f)
if T< chi2inv(0.95,f)
disp('协方差相等')
else
disp('协方差不等')
end
n11=0
n22=0
n33=0
for i=1:n1
w1(i,1)=m1*inv(s)*A1(i,:)'-1/2*m1*inv(s)*m1'+log(p1)
w1(i,2)=m2*inv(s)*A1(i,:)'-1/2*m2*inv(s)*m2'+log(p2)
w1(i,1)=m3*inv(s)*A1(i,:)'-1/2*m3*inv(s)*m3'+log(p3)
for j=1:3
if w1(i,j)==max(w1(i,:))&j~=1
n11=n11+1
end
end
end
for i=1:n2
w2(i,1)=m1*inv(s)*A2(i,:)'-1/2*m1*inv(s)*m1'+log(p1)
w2(i,2)=m2*inv(s)*A2(i,:)'-1/2*m2*inv(s)*m2'+log(p2)
w2(i,3)=m3*inv(s)*A2(i,:)'-1/2*m3*inv(s)*m3'+log(p3)
for j=1:3
if w2(i,j)==max(w2(i,:))&j~=2
n22=n22+1
end
end
end
for i=1:n3
w3(i,1)=m1*inv(s)*A3(i,:)'-1/2*m1*inv(s)*m1'+log(p1)
w3(i,2)=m2*inv(s)*A3(i,:)'-1/2*m2*inv(s)*m2'+log(p2)
w3(i,3)=m3*inv(s)*A3(i,:)'-1/2*m3*inv(s)*m3'+log(p3)
for j=1:3
if w3(i,j)==max(w3(i,:))&j~=3
n33=n33+1
end
end
end
p00=(n11+n22+n33)/(n1+n2+n3) %这个编程是为了使用判别分析实现检验3个总体协方差和交叉误判率.
A=[1.82\x051.04\x050.27\x050.99\x050.79\x050.36\x050.24\x050.13\x050.28\x050.56\x050.75\x050.47\x050.05
57.97\x0553.32\x0563.18\x0543.36\x0549.34\x0548.98\x0542.31\x0540.81\x0537.92\x0556.49\x0548.5\x0553.69\x0515.96
47.51\x0538.79\x0535.4\x0535.16\x0532.66\x0534.42\x0535.95\x0534.11\x0533.4\x0535\x0535.48\x0532.1\x0531.58
3.78\x051.76\x050.97\x051.63\x051.49\x051.05\x050.94\x050.54\x050.38\x051.38\x051.41\x051.25\x050.08
2.41\x052.37\x051.25\x052.77\x052.7\x052.31\x051.21\x051.26\x052.13\x051.96\x051.89\x051.83\x050.62
85\x0598\x0541\x05118\x05120\x05144\x0521\x0532\x0534\x0535\x0553\x05157\x05106
8958\x056504\x052006\x056435\x057120\x054255\x052144\x051281\x051482\x051615\x052513\x052401\x052303
18.84\x0511.19\x057.03\x054.1\x0510.39\x056.67\x057.32\x055.46\x052.56\x0511.52\x0513.25\x053.67\x051
45234\x0513312\x054213\x0512460\x0518312\x059153\x054346\x053217\x053198\x058450\x055689\x057677\x05996
434085\x05229939\x0526111\x05144142\x05264419\x05102836\x0594792\x0513320\x0513889\x0582717\x0532678\x0544217\x053495
452219\x05171496\x0558629\x05320129\x05229353\x05180078\x0588311\x0538480\x0520000\x0583849\x0575575\x0525868\x0516455
1999.6\x051649.3\x05119.01\x05843.39\x054005.2\x05635.65\x0578.65\x0574.57\x05172.86\x05386.33\x05407.74\x05451.13\x0511.47
39.59\x0550.02\x0512.88\x0536.48\x0559.95\x0523.57\x056.3\x057.64\x056.91\x0526.66\x0532.75\x0514.61\x052.19
]'
A1=A([1 2 4 5],:)
A2=A([6 10 11 12],:)
A3=A([3 7 8 9 13],:)
n1=size(A1,1)
n2=size(A2,1)
n3=size(A3,1)
n=n1+n2+n3
k=3
p=13
f=p*(p+1)*(k-1)/2
d=(2*p^2+3*p-1)*(1/(n1-1)+1/(n2-1)+1/(n3-1)-1/(n-k))/(6*(p+1)*(k-1))
p1=n1/n
p2=n2/n
p3=n3/n
m1=mean(A1)
m2=mean(A2)
m3=mean(A3)
s1=cov(A1)
s2=cov(A2)
s3=cov(A3)
s=((n1-1)*s1+(n2-1)*s2+(n3-1)*s3)/(n-k)
M=(n-k)*log(det(s))-((n1-1)*log(det(s1))+(n2-1)*log(det(s2))+(n3-1)*log(det(s3)))
T=(1-d)*M
C=chi2inv(0.95,f)
if T< chi2inv(0.95,f)
disp('协方差相等')
else
disp('协方差不等')
end
n11=0
n22=0
n33=0
for i=1:n1
w1(i,1)=m1*inv(s)*A1(i,:)'-1/2*m1*inv(s)*m1'+log(p1)
w1(i,2)=m2*inv(s)*A1(i,:)'-1/2*m2*inv(s)*m2'+log(p2)
w1(i,1)=m3*inv(s)*A1(i,:)'-1/2*m3*inv(s)*m3'+log(p3)
for j=1:3
if w1(i,j)==max(w1(i,:))&j~=1
n11=n11+1
end
end
end
for i=1:n2
w2(i,1)=m1*inv(s)*A2(i,:)'-1/2*m1*inv(s)*m1'+log(p1)
w2(i,2)=m2*inv(s)*A2(i,:)'-1/2*m2*inv(s)*m2'+log(p2)
w2(i,3)=m3*inv(s)*A2(i,:)'-1/2*m3*inv(s)*m3'+log(p3)
for j=1:3
if w2(i,j)==max(w2(i,:))&j~=2
n22=n22+1
end
end
end
for i=1:n3
w3(i,1)=m1*inv(s)*A3(i,:)'-1/2*m1*inv(s)*m1'+log(p1)
w3(i,2)=m2*inv(s)*A3(i,:)'-1/2*m2*inv(s)*m2'+log(p2)
w3(i,3)=m3*inv(s)*A3(i,:)'-1/2*m3*inv(s)*m3'+log(p3)
for j=1:3
if w3(i,j)==max(w3(i,:))&j~=3
n33=n33+1
end
end
end
p00=(n11+n22+n33)/(n1+n2+n3) %这个编程是为了使用判别分析实现检验3个总体协方差和交叉误判率.
我改了一下,小错误
%%%%%w1(i,1)=m3*inv(s)*A1(i,:)'-1/2*m3*inv(s)*m3'+log(p3)
改为w1(i,3)=m3*inv(s)*A1(i,:)'-1/2*m3*inv(s)*m3'+log(p3)
然后运行就没错误了
%%%%%w1(i,1)=m3*inv(s)*A1(i,:)'-1/2*m3*inv(s)*m3'+log(p3)
改为w1(i,3)=m3*inv(s)*A1(i,:)'-1/2*m3*inv(s)*m3'+log(p3)
然后运行就没错误了
MATLAB编程出现问题,The expression to the left of the equals sign i
MATLAB调试出现The expression to the left of the equals sign is n
matlab Error:The expression to the left of the equals sign i
【matlab】Error: The expression to the left of the equals sign
MATLAb 提示The expression to the left of the equals sign is no
matlab出错:The expression to the left of the equals sign is no
matlab提示 The expression to the left of the equals sign is no
The expression to the left of the equals sign is not a valid
英语翻译这是MATLAB报错的内容:The expression to the left of the equals s
关于matlab,调试的时候出现Error:The expression to the left of the equa
Use the properties of logarithms to expand the expression as
matlab运行时出现问题In an assignment A(I) = B,the number of element