matlab中meshgrid函数的用法

在MATLAB中遇到了meshgrid函数,对其使用方式并不是很熟悉,查阅到资料了解到这个函数的主要用法

这个函数主要就是在划分网格的时候可以进行使用

[X,Y] = meshgrid(xgv,ygv),其中X,Y是大小相等的两个矩阵,xgv,ygv是两个矩阵矢量

X:通过将xgv复制length(ygv)行(严格意义上是length(ygv)-1行)得到
Y:首先对ygv进行转置得到ygv‘,将ygv‘复制(length(xgv)-1)次得到。
例如

[X,Y] = meshgrid(1:3,10:14)
X =

1     2     3
     1     2     3
     1     2     3
     1     2     3
     1     2     3

Y =

10    10    10
    11    11    11
    12    12    12
    13    13    13
    14    14    14

[X,Y]=meshgrid(gv);
就相当于[X,Y]=meshgrid(gv,gv);
例如
[X,Y]=meshgrid(1:3)

X =

1     2     3
     1     2     3
     1     2     3

Y =

1     1     1
     2     2     2
     3     3     3

文章转载原文:https://blog.csdn.net/hhhhhyyyyy8/article/details/76209094

原文地址:https://www.cnblogs.com/Cucucudeblog/p/10643490.html

时间: 2024-08-29 18:51:39

matlab中meshgrid函数的用法的相关文章

matlab中norm函数的用法

格式:n=norm(A,p) 功能:norm函数可计算几种不同类型的矩阵范数,根据p的不同可得到不同的范数 以下是Matlab中help norm 的解释 NORM   Matrix or vector norm. For matrices... NORM(X) is the largest singular value of X, max(svd(X)). NORM(X,2) is the same as NORM(X). NORM(X,1) is the 1-norm of X, the l

Matlab中intlinprog函数的用法总结

Matlab中 intlinprog函数用法简介 1.简介 intlinprog是matlab中用于求解混合整数线性规划(Mixed-integer linear programming)的一个函数,用法基本和linprog差不多 Matlab中,该模型的标注写法如下 \[ min\ f\,^Tx\;\; \s.t. \begin{equation} \left\{ \begin{array}{**lr**} x(intcon)\ are \ integers \ A \cdot x \leq

matlab 中max函数用法

Matlab中max函数在矩阵中求函数大小的实例如下:(1)C = max(A)返回一个数组各不同维中的最大元素.如果A是一个向量,max(A)返回A中的最大元素.如果A是一个矩阵,max(A)将A的每一列作为一个向量,返回一个行向量,向量的第i个元素是矩阵A的第i列上的最大值. 如果A是多维数组,max(A) treats the values along the first non-singleton dimension as vectors, returning the maximum v

awk中split函数的用法

The awk function split(s,a,sep) splits a string s into an awk array a using the delimiter sep. time=12:34:56 echo $time | awk '{split($0,a,":" ); print a[1]}' 12   echo $time | awk '{split($0,a,":" ); print a[3]}' 34   echo $time | awk

Matlab中plot函数全功能解析

Matlab中plot函数全功能解析 功能 二维曲线绘图 语法 plot(Y)plot(X1,Y1,...)plot(X1,Y1,LineSpec,...)plot(...,'PropertyName',PropertyValue,...)plot(axes_handle,...)h = plot(...)hlines = plot('v6',...) 描述 plot(Y)如果Y是m×n的数组,以1:m为X横坐标,Y中的每一列元素为Y坐标,绘制n条曲线:如果Y是n×1或者1×n的向量,则以1:n

PHP中spl_autoload_register函数的用法

spl_autoload_register (PHP 5 >= 5.1.2) spl_autoload_register — 注册__autoload()函数 说明bool spl_autoload_register ([ callback $autoload_function ] )将函数注册到SPL __autoload函数栈中.如果该栈中的函数尚未激活,则激活它们. 如果在你的程序中已经实现了__autoload函数,它必须显式注册到__autoload栈中.因为 spl_autoload

Delphi中 StrToIntDef函数的用法

Delphi中 StrToIntDef函数的用法: 比如我要判断一个文本框里输入的字符串能不能转换为integer类型,如果能,则返回转换后的整型数据,如果不能,则返回整数0,那么我就可以用strtointdef这个函数. 写法如下: 假设edit1.text:='1000'; 则strtointdef(edit1.text,0)返回值为1000. 如果edit1.text:='fdafds',则返回值为0. (如果你用strtoint(edit1.text)当edit1.text:='fdad

matlab中fspecial函数

fspecial函数 用于建立预定义的滤波算子,其语法格式为: h = fspecial(type) h = fspecial(type,para) 其中type指定算子的类型,para指定相应的参数: 2type的类型有 'average' averaging filter 为均值滤波,参数为hsize代表模板尺寸,默认值为[3,3]. H = FSPECIAL('average',HSIZE) returns an averaging filter H of size HSIZE. HSIZ

C++中substr函数的用法

原文地址:http://blog.csdn.net/no_retreats/article/details/7853066 C++中substr函数的用法 #include<string>#include<iostream>using namespace std; main(){string s("12345asdf");string a=s.substr(0,5);       //获得字符串s中 从第0位开始的长度为5的字符串//默认时的长度为从开始位置到尾