作业帮 > 综合 > 作业

初学MATLAB 遇到的问题:In an assignment A(I) = B,the number of eleme

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/08/27 04:46:20
初学MATLAB 遇到的问题:In an assignment A(I) = B,the number of elements in B and
A=[1,1,1,4,1,1/2;1,1,2,4,1,1/2;1,1/2,1,5,3,1/2;1/4,1/4,1/5,1,1/3,1/3;1,1,1/3,3,1,1;2,2,2,3,3,1]; [x,y]=eig(A);eigenvalue(1)=diag(y);lamda=eigenvalue(l); ci1=(lamda-6)/5;cr1=ci1/1.24 w1=x(:,1)/sum[x(:,1)] 总是显示:In an assignment A(I) = B,the number of elements in B and I must be the same.这是什么原因呢?
赋值有错误. 代码: clc; clear all; close all; A=[1,1,1,4,1,1/2;1,1,2,4,1,1/2;1,1/2,1,5,3,1/2;1/4,1/4,1/5,1,1/3,1/3;1,1,1/3,3,1,1;2,2,2,3,3,1]; [x,y]=eig(A); eigenvalue(:, 1)=diag(y); lamda=eigenvalue(1); ci1=(lamda-6)/5; cr1=ci1/1.24 w1=x(:,1)/sum(x(:,1)) 结果: cr1 = 0.0996 w1 = 0.1507 0.1792 0.1886 0.0472 0.1464 0.2879 >>
满意请采纳