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

相关推荐
ytttr8735 小时前
MATLAB基于LDA的人脸识别算法实现(ORL数据库)
数据库·算法·matlab
wuk9985 小时前
matlab为地图进行四色着色
开发语言·matlab
元周民7 小时前
matlab求两个具有共根的多项式的所有共根(未详细验证)
开发语言·matlab
代码小小只8 小时前
考虑不确定性的电动汽车优化问题
matlab
康谋自动驾驶11 小时前
aiData全自动化数据处理解决方案!
自动驾驶·数据处理·传感器·数据标注·数据闭环·端对端
yong999011 小时前
基于小波分析与粒子群算法的电网潮流优化实现(MATLAB)
开发语言·算法·matlab
Dev7z12 小时前
基于MATLAB HSI颜色空间的图像美颜系统设计与实现
开发语言·matlab
ghie909012 小时前
MATLAB 高速公路裂缝检测
开发语言·matlab
天呐草莓15 小时前
热传导方程
算法·matlab
hoiii18716 小时前
基于MATLAB实现无监督数据建模
开发语言·matlab