不管怎样, 逗号分开的是维度, 所以数据的排列只考虑一维即可, 其他照搬
对于数据
[a11a12a13a21a22a23]\begin{bmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \end{bmatrix}[a11a21a12a22a13a23]
先竖着每 维画线段, 然后 下一个column作 为新的线段 , 所以线段 为
a11a_{11}a11到a21a_{21}a21
a12a_{12}a12到a22a_{22}a22
a13a_{13}a13到a23a_{23}a23
A= [0 0 ;
1 0 ;
1 1 ];
B = [0 1 ;
1 2;
2 1 ];
hold on;
% plot([A(1,1) B(1,1)] , [ A(1,2) B(1,2) ] );
% plot([A(2,1) B(2,1)] , [ A(2,2) B(2,2) ] );
% plot([A(3,1) B(3,1)] , [ A(3,2) B(3,2) ] );
plot([A(:,1) B(:,1)]', [A(:,2) B(:,2)]');
% camproj('perspective');
axis square;
% axis off;
% hold on;

如果是这样的数据
[a11a12a21a22a31a32]\begin{bmatrix}
a_{11} & a_{12} \\
a_{21} & a_{22} \\
a_{31} & a_{32}
\end{bmatrix}⎣⎡a11a21a31a12a22a32⎦⎤
那么 就是线段
a11a_{11}a11到a21a_{21}a21
a21a_{21}a21到a31a_{31}a31
a12a_{12}a12到a22a_{22}a22
a22a_{22}a22到a32a_{32}a32
A= [0 0 ;
1 0 ;
1 1 ];
B = [0 1 ;
1 2;
2 1 ];
hold on;
% plot([A(1,1) B(1,1)] , [ A(1,2) B(1,2) ] );
% plot([A(2,1) B(2,1)] , [ A(2,2) B(2,2) ] );
% plot([A(3,1) B(3,1)] , [ A(3,2) B(3,2) ] );
plot([A(:,1) B(:,1)], [A(:,2) B(:,2)]);
% camproj('perspective');
axis square;
% axis off;
% hold on;

可以看到是四条线段
本文详细介绍了一种使用线段连接矩阵中元素的可视化方法,适用于不同维度的数据集。通过实例展示了如何在MATLAB中绘制二维矩阵数据,帮助读者理解数据间的关联。

381

被折叠的 条评论
为什么被折叠?



