MATLAB制图代码【第二版】

MATLAB制图代码【第二版】

文档描述

Code describtion: This code is version 2 used for processing the data from the simulation and experiment.

Time : 2023.9.3

Author: PEZHANG

这是在第一版基础上,迭代出的第二版MATLAB制图代码,第二版的特点是以handle 的形式控制图窗的properties,此种形式更加贴近MATLAB的内在。

前置知识

figure图窗分为曲线、坐标轴、图窗背景三部分,这三个部分可以通过handle的形式对其properties进行操纵。

源代码

c 复制代码
clc;clear
close all

% get x、y data
x = 0:pi/20:2*pi;
y = sin(x);

% get the properties of line
l = plot(x,y);
l.LineWidth = 1;

% get the properties of figure
h = gcf;
h.Color = 'w';
h.Units = 'centimeters';
h.Position = [25 10 15 9];

% get the properties of axes
ax = gca;
ax.YGrid = 'on';
ax.FontSize = 13;
ax.XLabel.String = '时间 (s)';
ax.YLabel.String = '振幅 (m)';
ax.Title.String = '示例-正弦曲线';
ax.GridLineStyle = '--';
ax.Box = 'off';
print('-djpeg','-r600','示例-正弦曲线')

代码运行结果图

参考资料

【1】https://www.youtube.com/watch?v=CNayChYLAV8

【2】https://www.youtube.com/watch?v=sPC1-7K6qNU

【3】https://blog.csdn.net/qq_50632468/article/details/129691250

相关推荐
灵析表格2 小时前
灵析表格函数精讲|Query运行Sql:自定义SQL取数
excel·办公自动化·wps·效率工具·数据处理·ai办公·函数公式
星夜离尘5613 小时前
MATLAB:标定表有平台段时,反查为什么要返回一个区间?
matlab
灵析表格14 小时前
灵析表格函数精讲|Json转表格_Pro:复杂嵌套与选型
json·excel·办公自动化·wps·效率工具·数据处理·ai办公
RestCloud15 小时前
ETLCloud中不同表名之间的数据库数据同步
数据库·etl·数据处理·etlcloud·数据传输·数据集成平台
Evand J19 小时前
【MATLAB例程】基于多基站AOA与距离辅助的二维运动目标定位及速度估计,附下载链接
开发语言·matlab·距离·aoa·多基站
xrgs_shz1 天前
ChatGPT 辅助实现树上柿子分割(MATLAB版)
人工智能·matlab
灵析表格2 天前
灵析表格函数精讲|AI_NLP_提取重点关键词:抓商品标题核心词
excel·办公自动化·wps·效率工具·数据处理·ai办公·函数公式
Evand J3 天前
【CIR系列2】UWB视距(LOS)与非视距(NLOS)信道冲激响应(CIR)建模与对比,MATLAB
开发语言·matlab·信号处理·nlos·cir
星夜离尘563 天前
MATLAB:标定表局部倒退,为什么不能排序?
android·开发语言·matlab
星夜离尘563 天前
MATLAB:前后各滤一次,为什么相位回来了,幅值却变成 0.500?
开发语言·matlab