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

相关推荐
雨洛lhw1 小时前
matlab设计滤波器详解
matlab·低通滤波器·滤波器设计流程
熊猫_豆豆2 小时前
MATLAB水滴下落湖水面泛起涟漪仿真
开发语言·matlab·水滴仿真
MATLAB代码顾问17 小时前
MATLAB实现模糊PID控制
开发语言·matlab
熊猫_豆豆1 天前
嫦娥号地月轨道、环月(一个月)MATLAB仿真
开发语言·matlab
fie88892 天前
基于MATLAB的LBFGS优化算法实现
算法·matlab
wuk9982 天前
基于有限差分法的二维平面热传导模型MATLAB实现
开发语言·matlab·平面
csdn_aspnet3 天前
分享MATLAB在数据分析与科学计算中的高效算法案例
算法·matlab·数据分析
青春不败 177-3266-05203 天前
AI+ArcGIS:数据处理、空间分析、可视化前沿技术应
人工智能·arcgis·gis·生态学·可视化·数据处理
弈风千秋万古愁3 天前
【PID】连续PID和数字PID chapter1(补充) 学习笔记
笔记·学习·算法·matlab
RestCloud3 天前
OceanBase 分布式数据库的 ETL 实践:从抽取到实时分析
数据库·分布式·postgresql·oceanbase·etl·数据处理·数据同步