如何绘制n维矩阵? [英] How to plot n dimmensional matrix?
本文介绍了如何绘制n维矩阵?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想用矩阵的计算平均值来可视化我的矩阵. 我想在同一窗口中绘制这些点和均值.
I want to visualize my matrix with the computed mean of that matrix. And I want to plot that points and the mean at the same window.
这是我的矩阵和均值
Input=4 1 1
3 9 0
2 5 5]
Average=mean(Input
如何绘制它?
使用此命令绘制图我:
plot(InputMatrix(:,:,:),Average'*');
有9点,但是我只需要矩阵3点和均值1点...
There are 9 points, but I just need 3 points from matrix and 1 point of the mean...
1st point from -->4 3 2
2nd point from -->1 9 0
3rd point from -->1 0 5
the 4th point is -->the mean / average
推荐答案
You can use plot3
:
plot3(Input(1,:),Input(2,:),Input(3,:),'o') %// plot each point (in 3D)
hold on
m = mean(Input,2); %// compute mean of all points
plot3(m(1),m(2),m(3),'*') %// plot the mean
这篇关于如何绘制n维矩阵?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文