MATLAB surf meshgrid问题-2矢量1矩阵-曲面图 [英] MATLAB surf meshgrid issue - 2 vectors 1 matrix - surface plot

查看:112
本文介绍了MATLAB surf meshgrid问题-2矢量1矩阵-曲面图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2个向量和一个矩阵,我想绘制一个表面图.

I have 2 vectors and one matrix and I would like to make a surface plot.

  1. 第一个向量A,距离向量A = 1:1:100(大小1100);
  2. 第二向量B,时间向量B = 1:1:10(大小为10);
  3. 矩阵C,每一列都有每个B值(大小100 10)的数据

如何使用Meshgrid和/或surf函数获取曲面3D图?

How could I use the meshgrid and/or the surf function for getting a surface 3D plot?

推荐答案

[AA, BB] = ndgrid(A,B);
surf(BB,AA,C)

或使用 surf 的版本两个向量作为其两个第一个输入:

Or use the version of surf that allows two vectors as its two first inputs:

surf(B,A,C)

对于您的特定向量([1 2 ...]),可以将其简化为单输入版本

which for your particular vectors ([1 2 ...]) could be simplified to the single-input version

surf(C)

这篇关于MATLAB surf meshgrid问题-2矢量1矩阵-曲面图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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