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

相关推荐
bu_shuo21 小时前
MATLABSimulink连接线变为斜线解决方案
matlab·simulink
jghhh0121 小时前
使用 MATLAB 实现支持向量回归 (SVR) 预测未来数据
算法·matlab
fengfuyao9851 天前
EWT(经验小波变换)MATLAB实现与应用
开发语言·matlab
gihigo19981 天前
30节点系统最优潮流计算(MATLAB实现)
开发语言·matlab
sxjk19871 天前
WPS表格REGEXP公式提取车牌学习
学习·wps·表格·数据处理
漂视数字孪生世界1 天前
2026环保装备数字孪生平台对比选型
数据可视化
foundbug9991 天前
MATLAB时频分析工具箱:基于FRFT的信号检测与参数估计
开发语言·matlab
漂视数字孪生世界1 天前
环保装备数字孪生解决方案选型指南2026
数据可视化
漂视数字孪生世界1 天前
从零开始:环保装备数字孪生开发选型2026
数据可视化
墨者阳1 天前
可观・可控・可治:DB运维平台架构设计与实践
运维·数据库·架构·自动化·数据可视化