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

相关推荐
RestCloud9 小时前
流式优先数据架构:从批量ETL到事件驱动架构的演进之路
数据仓库·etl·cdc·数据处理·数据集成·数据传输·数据同步
Aaron15881 天前
RFSOC+VU13P+RK3588的核心优势与应用场景分析
嵌入式硬件·算法·matlab·fpga开发·信息与通信·信号处理·基带工程
代码改善世界1 天前
【MATLAB初阶】矩阵操作(一)
开发语言·matlab·矩阵
Trouvaille ~1 天前
【MySQL】视图:虚拟表的妙用
数据库·mysql·adb·面试·数据处理·后端开发·视图
yuan199971 天前
使用模糊逻辑算法进行路径规划(MATLAB实现)
开发语言·算法·matlab
B325帅猫-量子前沿技术研究所1 天前
MATLAB函数fft(data,N)输入注意事项
matlab·傅里叶分析·fft·噪声功率谱
飞舞哲1 天前
Coppeliasim基于视觉识别与路径插值的UR机械臂彩色物块自动分拣系统
matlab·视觉检测·coppeliasim·ur·分拣
沅_Yuan1 天前
基于 CNN-SE Attention-ITCN 多模态融合的多输入单输出回归预测模型【MATLAB】
神经网络·matlab·cnn·回归预测·多输入单输出·se attention·itcn
可编程芯片开发1 天前
基于Qlearning强化学习的源荷扰动下交直流微电网负荷频率控制算法matlab仿真
matlab·强化学习·交直流微电网·qlearning·负荷频率控制
DS数模1 天前
2026年Mathorcup数学建模竞赛A题思路解析+代码+论文
开发语言·数学建模·matlab·mathorcup·妈妈杯·2026妈妈杯