Matlab %肆
第四章:Graph
Plot form 'Data'
plot(x,y);
plot(y); %x = [1…n], n = length(y)
EG1:
plot(cos(0:pi/20:2*pi));
EG1.1:
plot(cos(0:pi/20:2*pi));
plot(sin(0:pi/20:2*pi)); %会覆盖旧的图形,除非使用hold指令
hold on/off
EG:
hold on
plot(cos(0:pi/20:2*pi));
plot(sin(0:pi/20:2*pi)); %两个图像在一个坐标轴
hold off
plot(x,y,'str')
%str是图像的一些参数进行一个改变的动作,具体指令如下所示
Data markers
Dot(.)——.
Asterisk( * )——*
Cross(×)——X
Circle(○)——o
Plus sign(+)——+
Square(□)——s
Diamond(♢)——d
Five-pointed star(☆)——p
Triangle(下三角)——v
Triangle(上三角)——^
Triangle(左三角【指向右边】)——<
Triangle(右三角【指向左边】)——>
hexagram——H
Line types
Solid line -
Dashed line --
Dash-dotted line -.
Dotted line :
Colors
Black——k
Blue——b
Cyan——c
Green——g
Magenta——m
Red——r
White——w
Yellow——y
更多详情查看linespec
legend()
%标记图例
EG1:
x = 0:0.5:4*pi;
y = sin(x);
h = cos(x);
w = 1./(1+exp(-x));
g = (1/(2*pi*2)^0.5).*exp((-1.*(x-2*pi).^2)./(2*2^2));
plot(x,y,'bd-',x,h,'gp',x,w,'ro-',x,g,'c^-');
legend('sin(x)','cos(x)','Sigmoid','Gauss function');
title()
xlabel()
ylabel()
zlabel() %三维画图
%加标题
EG:
x = 0:0.1:2*pi;
y1 = sin(x);
y2 = exp(-x);
plot(x,y1,'--*',x,y2,':o');
xlabel('t = 0 to 2\pi'); %输出2π,如果input‘2π’,output‘6.28’
ylabel('values of sin(t) and e^{-x}'); %特殊字符e^{-x}
title('Function Plots of sin(t) and e^{-x}');
legend('sin(t)','e^{-x}');
text() and annotation()
%使用LaTex达到一些花里胡哨的效果
EG1:
x = linspace(0,3); %定义域
y = x.^2.*sin(x);
plot(x,y);
line([2,2],[0,2^2*sin(2)]); %在图上画一个line
str = '$$ \int_{0}^{2} x^2\sin(x) dx $$'; %表示定积分符号
text(0.25,2.5,str,'Interpreter','latex'); %后面的两个引号是固定表示,详情自查
annotation('arrow','X',[0.32,0.5],'Y',[0.6,0.4]); %生成箭头
Figure Adjustment
Graphical Objects: Figure,Axes,Line
Handle of An Object
gca %axes
gcf %figure
allchild %find all children of specified objects
ancestor %find ancestor of graphics object
delete %delete an object
findall %dinf all graphics objects
Fetch or Modifying Properties
To fetch properties
get();
eg1:
x = linspace(1,2*pi,1000);
y = sin(x);
plot(x,y);
h = plot(x,y);
get(h);
get(gca)
eg2:
set(gca,'XLim',[0,2*pi]);
set(gca,'YLim',[-1.2,1.2]);
set(gca,'FontSize',25); %坐标数字大小
%%
set(gca,'XTick',0:pi/2:2*pi); %坐标点位
set(gca,'XTickLabel',0:90:360); %坐标表示
%%
set(gca,'FontName','symbol'); %转handle
set(gca,'XTickLabel',{'0','p/2','p','3p/2','2p'}); %改表示
Line Specification
set(h,'LineStyle','-.','LineWidth',7.0,'Color','g');
%%
plot(x,y,'-.g',...,'LineWidth',7.0);
%delete(),删除图像,但是不删除变量
Maker Specification
x = rand(20,1);
set(gca,'FontSize',18);
plot(x,'-md','LineWidth',2,'MarkerEdgeColor','k','MarkerFaceColoe'...
'g','MarkerSize',10);
xlim([1,20]);
Multiple Figures
x = -10:0.1:10;
y1 = x.^2-8;
y2 = exp(x);
figure
plot(x,y1);
figure
plot(x,y2);
%gca与gcf只能找到最新的图像
figure('Position',[left,bottom],width,height);
%%%%%%%
subplot(m,n,1); %多图放一张 n:column;m:row;1:1~n个图
eg:
t = 0:0.1:2*pi;
x = 3*cos(t);
y = sin(t);
subplot(2,2,1);
plot(x,y);
axis normal;
subplot(2,2,2);
plot(x,y);
axis square; %x与y轴的整体长度相等
subplot(2,2,3);
plot(x,y);
axis equal; %x与y轴上面的单位长度等距
subplot(2,2,4);
plot(x,y);
axis equal tight; %贴近图像
grid on/off %格线
box on/off %边框
axis on/off %坐标图
axis nomal
axis aquare
axis equal
axis equal tight
axis image
axis ij
axis xy
%自查
Saving Figures into Files
saveas(gcf,'<filename>','<formattype>');
%%%%%%
---Bitmap
jpeg
png
tiff
bmpmono
bmp
bmp256 ---Vector(sanse推荐)
eps
epsc
meta
svg
ps
psc %更多查询print
Matlab %肆的更多相关文章
- Matlab 绘制三维立体图(以地质异常体为例)
前言:在地球物理勘探,流体空间分布等多种场景中,定位空间点P(x,y,x)的物理属性值Q,并绘制三维空间分布图,对我们洞察空间场景有十分重要的意义. 1. 三维立体图的基本要件: 全空间网格化 网格节 ...
- Matlab slice方法和包络法绘制三维立体图
前言:在地球物理勘探,流体空间分布等多种场景中,定位空间点P(x,y,x)的物理属性值Q,并绘制三维空间分布图,对我们洞察空间场景有十分重要的意义. 1. 三维立体图的基本要件: 全空间网格化 网格节 ...
- Matlab 高斯_拉普拉斯滤波器处理医学图像
前言:本程序是我去年实现论文算法时所做.主要功能为标记切割肝脏区域.时间有点久,很多细节已经模糊加上代码做了很多注释,因此在博客中不再详述. NOTE: 程序分几大段功能模块,仔细阅读,对解决医学图像 ...
- MATLAB中绘制质点轨迹动图并保存成GIF
工作需要在MATLAB中绘制质点轨迹并保存成GIF以便展示. 绘制质点轨迹动图可用comet和comet3命令,使用例子如下: t = 0:.01:2*pi;x = cos(2*t).*(cos(t) ...
- linux下配置matlab运行环境(MCR)
在安装好的matlab下有MCR(MatlabCompilerRuntime)在matlab2011/toolbox/compiler/deploy/glnxa64下找到MCRInstaller.zi ...
- EMD分析 Matlab 精华总结 附开源工具箱(全)
前言: 本贴写于2016年12与15日,UK.最近在学习EMD(Empirical Mode Decomposition)和HHT(Hilbert-Huang Transform)多分辨信号处理,FQ ...
- Atitit MATLAB 图像处理 经典书籍attilax总结
Atitit MATLAB 图像处理 经典书籍attilax总结 1.1. MATLAB数字图像处理1 1.2. <MATLAB实用教程(第二版)>((美)穆尔 著)[简介_书评_在线阅读 ...
- Atitit MATLAB 图像处理attilax总结
Atitit MATLAB 图像处理attilax总结 1.1. 下载 Matlab7.0官方下载_Matlab2012 v7.0 官方简体中文版-办公软件-系统大全.html1 1.2. Matla ...
- Atitit java c# php c++ js跨语言调用matlab实现边缘检测等功能attilax总结
Atitit java c# php c++ js跨语言调用matlab实现边缘检测等功能attilax总结 1.1. 边缘检测的基本方法Canny最常用了1 1.2. 编写matlab边缘检测代码, ...
- 使用MATLAB对图像处理的几种方法(下)
试验报告 一.试验原理: 图像点处理是图像处理系列的基础,主要用于让我们熟悉Matlab图像处理的编程环境.灰度线性变换和灰度拉伸是对像素灰度值的变换操作,直方图是对像素灰度值的统计,直方图均衡是对 ...
随机推荐
- svn 报 is not a working copy 错误
当时提交代码 svn 报 is not a working copy ,上网查找问题 要我重新拉代码下来 然后放进修改的代码重新提交,我觉得很不合理,我看了下我提交的代码文件有80多个,我在想是否 ...
- Python学习笔记文件读写之遍历目录树
随笔记录方便自己和同路人查阅. #------------------------------------------------我是可耻的分割线--------------------------- ...
- redis使用示例
package com.atguigu.gulimall.product;import com.alibaba.fastjson.JSON;import com.alibaba.fastjson.Ty ...
- SHR常用f7[更新ing]
<field id="unit" name="unit" label="单位" dataType="F7" uip ...
- BurpSuite暴力破解和防御实战
burpsuite暴力破解 工具准备 burp suite 用于攻击web 应用程序的集成平台 jsEncrypter 一个用于前端加密Fuzz的Burp Suite插件,支持base64.sha.m ...
- django学习:转载
https://www.cnblogs.com/ginvip/p/6894690.html https://www.cnblogs.com/yangmv/p/5327477.html https:// ...
- 查看linux进程启动运行时间
ps -eo pid,tty,user,lstart,etime,cmd|grep nginx 参数说明: pid:进程ID tty:终端 user:用户 lstart:开始时间 etime:运行时间 ...
- vite 路径别名 @ 配置
vite.config.ts resolve.alias 配置 const path = require('path'); import { defineConfig } from 'vite'; i ...
- 快速搭建一个spring cloud 子模板--好记性不如烂笔头
建 application.yml 文件 server: # 服务端口号 port: 7609spring: application: # 服务名称 - 服务之间使用名称进行通讯 name: serv ...
- springboot自动装配静态成员变量
首先要说的是,springboot并不能装配静态类,但可以通过以下骚操作来实现: @Component public class StatisticLogger { private static Da ...