当前位置:网站首页>Mesh data generation function meshgrid
Mesh data generation function meshgrid
2022-07-28 21:52:00 【Frost Creek】
Want to draw a three-dimensional picture , Getting grid coordinates is very important ,matlab There's a name meshgrid Function of , It is easy to generate gridded coordinates according to parameters , Of course , These gridded coordinates are generated by a specific calculation method .
grammar :
[X,Y] = meshgrid(x,y)
[X,Y] = meshgrid(x)
explain : Here is the first way ,x,y Is a vector , And the resulting X,Y It's a matrix . among X Each line of is made up of x The numbers in form in order ,Y Each column of is composed of y The numbers in form in order .
The second way is essentially x And y An abbreviation in the case of equality .
Let's look at some examples :
>> x=1:4
x =
1 2 3 4
>> y=1:5
y =
1 2 3 4 5
>> [X,Y]=meshgrid(x,y)
X =
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
Y =
1 1 1 1
2 2 2 2
3 3 3 3
4 4 4 4
5 5 5 5
It can be seen that , Generated X,Y The dimensions are the same , The same location data forms a group of numbers ( coordinate ), This forms a grid .
Of course , There is another way to generate grid data ,
>> x=1:4
x =
1 2 3 4
>> y=(1:5)'
y =
1
2
3
4
5
>> X=ones(size(y))*x
X =
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
>> Y=y*ones(size(x))
Y =
1 1 1 1
2 2 2 2
3 3 3 3
4 4 4 4
5 5 5 5
The results of the two methods are the same , Of course ,meshgrid Functions are much more complex , Interested can be found in matlab Command line input edit meshgrid, open meshgrid Look at the function . After getting the grid data , Then you can draw three-dimensional graphics .
>> Z=X.^2+Y
Z =
2 5 10 17
3 6 11 18
4 7 12 19
5 8 13 20
6 9 14 21
>> surf(X,Y,Z)

Such a three-dimensional figure has been drawn , In essence, it is to combine two-dimensional coordinates with the third coordinate to form three-dimensional coordinates , Then connect , Fill the resulting surface .
My public number : Simple programming journey
Welcome to your attention !
边栏推荐
- 详解visual studio 2015在局域网中远程调试程序
- Leetcode 19. delete the penultimate node of the linked list [knowledge points: speed pointer, recursion, stack]
- 网格数据生成函数meshgrid
- Discussion: if you want to land Devops, is it enough to only consider a good PAAS container platform?
- 微星宝安工厂失火!官方回应:无人员受伤,产线不受影响!
- The general strike of three factories in St France may make the shortage of chips more serious!
- 株洲市九方中学开展防溺水、消防安全教育培训活动
- 中国科学家首次用DNA构造卷积人工神经网络,可完成32类分子模式识别任务,或用于生物标志物信号分析和诊断
- 世界肝炎日 | 基层也能享受三甲资源,智慧医疗系统如何解决“看病难”?
- 蚂蚁集团境外站点 Seata 实践与探索
猜你喜欢

大学荒废三年,大四自学7个月测试,找到了12K的工作

中文招聘文档中专业技能词抽取的跨域迁移学习

网格数据生成函数meshgrid

Pytorch learning record (4): over fitting, convolution neural network CNN

Detailed explanation of JVM memory layout (glory collection version)

Research on intangible cultural heritage image classification based on multimodal fusion

蚂蚁集团境外站点 Seata 实践与探索

Versailles ceiling: "the monthly salary of two years after graduation is only 35K, which is really unpromising ~ ~"

基于Paragraph-BERT-CRF的科技论文摘要语步功能信息识别方法研究

Research on weapon equipment attribute extraction based on attribute word completion
随机推荐
株洲市九方中学开展防溺水、消防安全教育培训活动
八、QOS队列调度与报文丢弃
Why does Baidu search only crawl, but not show the page?
For the 1000 yuan 5g mobile phone market, MediaTek Tianji 700 released
Edited by vimtutor
Cloud security core technology
Cy3/Cy5/Cy5.5/Cy7荧光标记抗体/蛋白试剂盒(10~100mg标记量)
Pytorch学习记录(四):过拟合、卷积神经网络CNN
Is it necessary to calibrate the fluke dtx-1800 test accuracy?
Zhuzhou Jiufang middle school carried out drowning prevention and fire safety education and training activities
Automatic filling of spare parts at mobile end
Mysql的B+树高度计算
Versailles ceiling: "the monthly salary of two years after graduation is only 35K, which is really unpromising ~ ~"
Cross domain transfer learning of professional skill word extraction in Chinese recruitment documents
For the next generation chromebook, MediaTek launched new chipsets mt8192 and mt8195
顺序表的实现
标准C语言学习总结10
Leetcode linked list problem -- 142. circular linked list II (learn the linked list by one question and one article)
基于复杂网络的大群体应急决策专家意见与信任信息融合方法及应用
Leetcode interview question 02.07. Linked list intersection [knowledge points: Double pointers, stack]