当前位置:网站首页>Matlab画图3
Matlab画图3
2022-08-05 02:31:00 【万年老竹】
Matlab画图 3
1.练习:完成下图的效果
G=[46 38 29 24 13]; S=[29 27 17 26 8]; B=[29 23 19 32 7];
h=bar(1:5,[G' S' B']);
set(h(1),'FaceColor',[1 1 0]);
set(h(2),'FaceColor',[0.7 0.7 0.7]);
set(h(3),'FaceColor',[1 0.6 0.1]);
title('Medal count for top 5countries in 2012 Olympics');
ylabel('Number of medals'); xlabel('Country');
set(gca, 'XTickLabel',{'USA','CHN','GBR','RUS','KCR'});
legend('Gold','Silver','Bronze');
结果如下
2.imagesc函数、color bar与color map
适用场景:多维图像难以直观反映值的变化时,利用imagesc函数使用颜色显示图像;ColorBar在图中起到图例的作用,ColorMap则可以调整色温
eg:
[x,y]=meshgrid(-3:.2:3,-3:.2:3);
z=x.^2+x.*y+y.^2;surf(x,y,z);box on;
set(gca,'FontSize',16);zlabel('z');
xlim([-4 4]);xlabel('x');ylim([-4 4]);ylabel('y');colormap('turbo');
imagesc(z);axis square;xlabel('x');ylabel('y');
colorbar;colormap('turbo');
结果如下
3.3D绘图 3D Plots
4.mesh()与surf()
mesh是表格,surface是表面
eg:
x=-3.5:0.2:3.5;y=-3.5:0.2:3.5;
[X,Y]=meshgrid(x,y);
Z=x.*exp(-X.^2-Y.^2);
subplot(1,2,1);mesh(X,Y,Z);
subplot(1,2,2);surf(X,Y,Z);
结果如下
meshc()和surfc()与mesh()与surf()的区别在于底部会多一个contour图像
5.Various Countour Plots
eg:
x=-3.5:0.2:3.5;y=-3.5:0.2:3.5;
[X,Y]=meshgrid(x,y);
Z=x.*exp(-X.^2-Y.^2);
subplot(1,2,1);mesh(X,Y,Z);
axis square
subplot(1,2,2);contour(X,Y,Z);
axis square;
结果如下:
6.view(),light(),patch()
不想看了,摆烂
边栏推荐
- Hypervisor related knowledge points
- hypervisor相关的知识点
- [机缘参悟-60]:《兵者,诡道也》-2-孙子兵法解读
- Understand the recommendation system in one article: Recall 06: Two-tower model - model structure, training method, the recall model is a late fusion feature, and the sorting model is an early fusion
- Regular expression to match a certain string in the middle
- sql语句多字段多个值如何进行排序
- 注意潍坊开具发票一般需要注意
- 【MySQL series】- Does LIKE query start with % will make the index invalid?
- 后期学习计划
- 【OpenCV 图像处理2】:OpenCV 基础知识
猜你喜欢
select 标签自定义样式
KingbaseES V8 GIS data migration solution (2. Introduction to the capabilities of Kingbase GIS)
关于#sql shell#的问题,如何解决?
正则表达式,匹配中间的某一段字符串
".NET IoT from scratch" series
Programmer's list of sheep counting when insomnia | Daily anecdote
DAY23:命令执行&代码执行漏洞
英特尔 XDC 2022 精彩回顾:共建开放生态,释放“基建”潜能
特殊矩阵的压缩存储
shell语句修改txt文件或者sh文件
随机推荐
SDC简介
剑指offer专项突击版第20天
Pisanix v0.2.0 发布|新增动态读写分离支持
PHP Skills Assessment
LeetCode uses the minimum cost to climb the stairs----dp problem
Greenplum数据库故障分析——版本升级后gpstart -a为何返回失败
leetcode-对称二叉树
回顾51单片机
Transfer Learning - Distant Domain Transfer Learning
亚马逊云科技 + 英特尔 + 中科创达为行业客户构建 AIoT 平台
Greenplum Database Fault Analysis - Can a Soft Connection Be Made to the Database Base Folder?
.Net C# Console Create a window using Win32 API
没有对象的程序员如何过七夕
Semi-Decentralized Federated Learning for Cooperative D2D Local Model Aggregation
蚁剑高级模块开发
使用OpenVINO实现飞桨版PGNet推理程序
C学生管理系统 据学号查找学生节点
the mechanism of ideology
DAY22:sqli-labs 靶场通关wp(Less01~~Less20)
shell statement to modify txt file or sh file