你的z应该是一个3*3矩阵,应该写作z=zeros(3,3)程序修改如下:x=[1 4 5 ]'z=zeros(3,3);%%%%%%%%%%%%%%%%%%for i=1:1:3 for j=1:1:3 y=2*i*x(i)+j*x(i) z(i,j)=y;%%%%%%%%%%%%%%%%%%%%% end end 如果满意就采纳吧吧