错误:输入网格不是有效的Meshgrid [英] Error: Input grid is not a valid Meshgrid

查看:1430
本文介绍了错误:输入网格不是有效的Meshgrid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题.所以我有一个XxYxZ = 10x5x20的3D矩阵.我想在等值面的帮助下绘制此矩阵.所以首先我需要创建一个网格,但是当我说以下内容时,这是第一个问题:[X,Y,Z] = meshgrid(1:10,1:5,1:20)我得到一个5x10x20的网格,但是我想要10x5x20.为什么是这样?我的想法是只更改X和Y [Y,X,Z] = meshgrid(1:10,1:5,1:20),当我尝试借助此网格来绘制矩阵时:isosurface(X,Y,Z,M)我收到错误消息输入网格不是有效的MESHGRID"

I have a question. So I have a 3D matrix of XxYxZ = 10x5x20. I want to plot this matrix with the help of isosurface. So first I need to create a mesh grid, but here comes the first problem when I say: [X,Y,Z] = meshgrid(1:10,1:5,1:20) I get a grid of 5x10x20, but I want 10x5x20. Why is this? My idea was to just change the X and Y [Y,X,Z] = meshgrid(1:10,1:5,1:20) When I try to plot the matrix with the help of this grid: isosurface(X,Y,Z,M) I get the error "Input grid is not a valid MESHGRID"

出什么问题了?

谢谢

推荐答案

您被matlab搞砸了,X维度是第二个,Y维度是第一个.按照说明使用它:

You got screwed by matlab, the X-Dimension is the second and the Y-Dimension is the first. Use it as documented:

[m,n,p] = size(V)
[X,Y,Z] = meshgrid(1:n,1:m,1:p)
isosurface(X,Y,Z,V)

请注意第一行和第二行中n和m的交换顺序.

Please notice the swapped order of n and m in the first and second line.

这篇关于错误:输入网格不是有效的Meshgrid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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