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

相关推荐
Gofarlic_oms120 小时前
利用API实现ANSYS许可证管理自动化集成
运维·服务器·开发语言·matlab·自动化·负载均衡
小白小宋1 天前
【PUSCH第三期】5G NR QC-LDPC编码深度解析:从协议校验矩阵构造到MATLAB完整实现
5g·matlab·矩阵
国产化创客1 天前
龙芯 2K0300-- 实现工业网关监控仪表盘项目
嵌入式硬件·物联网·数据可视化
我爱C编程1 天前
基于WSN无线传感器网络的定向步幻影路由算法matlab仿真
网络·matlab·无线传感器网络·wsn·定向步幻影路由
rit84324991 天前
高斯过程回归:原理与MATLAB实现
matlab·数据挖掘·回归
南宫萧幕1 天前
HEV 智能能量管理实战:从 MPC/PPO 理论解析到 Python-Simulink 联合仿真闭环全流程
开发语言·python·算法·matlab·控制
Gofarlic_oms11 天前
Allegro高级功能模块许可证管理注意事项
运维·服务器·开发语言·matlab·负载均衡
GIS地信小匠1 天前
(34)ArcGIS Pro 要素折点转点工具:线面节点批量提取实操
arcgis·空间分析·数据处理·gis教程·arcgls pro
南宫萧幕1 天前
车辆能量管理进阶:从前沿算法 (VMD-PPO-DBO) 机制解析到 MPC 工程建模
人工智能·算法·matlab·simulink·控制
无心使然1 天前
Openlayers调用ArcGis地图服务之五 —— 要素识别(/identify)
前端·vue.js·数据可视化