当前位置:网站首页>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 !
边栏推荐
- 基于复杂网络的大群体应急决策专家意见与信任信息融合方法及应用
- Detailed explanation of JVM memory layout (glory collection version)
- LeetCode链表问题——142.环形链表II(一题一文学会链表)
- Cloud security core technology
- Pytorch学习记录(四):过拟合、卷积神经网络CNN
- Why does Baidu search only crawl, but not show the page?
- 软考 --- 数据库(3)数据操作
- Wechat applet development company, do you know how to choose?
- 传微软已获得向华为供货许可!华为将迎来全面解禁?
- 凡尔赛天花板:“毕业两年月薪才35K,真是没出息啊~~”
猜你喜欢
![Leetcode 19. delete the penultimate node of the linked list [knowledge points: speed pointer, recursion, stack]](/img/86/c74a63c3465efbed74c2bf059bac4f.jpg)
Leetcode 19. delete the penultimate node of the linked list [knowledge points: speed pointer, recursion, stack]

融合LSTM与逻辑回归的中文专利关键词抽取

凡尔赛天花板:“毕业两年月薪才35K,真是没出息啊~~”

How to design workflow engine gracefully (glory Collection Edition)

怎样巧用断言+异常处理类,使代码更简洁!(荣耀典藏版)

Nano gold coupled antibody / protein Kit (20nm, 1mg/100 μ g/500 μ G coupling amount) preparation

数据插值——对不同量级的数据进行归一化

Achieve waterfall effect
![[英雄星球七月集训LeetCode解题日报] 第28日 动态规划](/img/79/bc763bb6f12c525454abda18be4265.png)
[英雄星球七月集训LeetCode解题日报] 第28日 动态规划

八、QOS队列调度与报文丢弃
随机推荐
Construction of Chinese traditional embroidery classification model based on xception TD
Four methods of multi-threaded sequential operation. Ask casually during the interview
Week 6 Linear Models for Classification (Part B)
二 RedisTemplate的序列和反序列化机制讲解
关于一些小需求,用案例方式记录
微信小程序开发公司你懂得选择吗?
Pytoch learning record (III): random gradient descent, neural network and full connection
将字符串指针赋值给数组[通俗易懂]
Matlab|基础知识总结一
Priced at 1.15 billion yuan, 1206 pieces of equipment were injected into the joint venture! Sk Hynix grabs the mainland wafer foundry market!
Record some small requirements in the form of cases
[brother hero July training] day 28: dynamic planning
Talk about row storage and column storage of database
Leetcode 142. circular linked list II [knowledge points: speed pointer, hash table]
Pytorch learning record (4): over fitting, convolution neural network CNN
实现瀑布流效果
What technology is needed for applet development
Meta opens the project aria pilot dataset and will develop real-time 3D maps in the future
Uniapp progress bar customization
详解visual studio 2015在局域网中远程调试程序