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

相关推荐
kaikaile199513 分钟前
matlab计算流场
人工智能·算法·matlab
gihigo199817 分钟前
基于MATLAB的周期方波与扫频信号生成实现(支持参数动态调整)
开发语言·matlab
FIT2CLOUD飞致云1 小时前
操作教程|DataEase企业总-分公司数据填报场景搭建实践
数据分析·开源·数据可视化·dataease·bi
yong99904 小时前
基于MATLAB的大变形悬臂梁求解程序
前端·数据库·matlab
guygg885 小时前
基于捷联惯导与多普勒计程仪组合导航的MATLAB算法实现
开发语言·算法·matlab
bu_shuo5 小时前
启动Simulink的几种方法
matlab·simulink
ytttr8735 小时前
MATLAB的流体动力学与热传导模拟仿真实现
开发语言·matlab
逝川长叹6 小时前
利用 SSI-COV 算法自动识别线状结构在环境振动下的模态参数研究(Matlab代码实现)
前端·算法·支持向量机·matlab
十三画者6 小时前
【文献分享】SpatialZ弥合从平面空间转录组学到三维细胞图谱之间的维度差距
人工智能·数据挖掘·数据分析·数据可视化
databook7 小时前
棒棒糖图:当条形图遇上极简美学
python·数据分析·数据可视化