如何绘制n维矩阵? [英] How to plot n dimensional matrix?

查看:83
本文介绍了如何绘制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

如何绘制??

使用此命令绘制图形 I:

To plot figure I using this command:

     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

推荐答案

您可以使用 plot3:

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆