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

相关推荐
漂视数字孪生世界5 小时前
2026年智能制造工厂数字孪生开发选型指南
数据可视化
laowangpython5 小时前
Gurobi求解器Matlab安装配置教程
开发语言·其他·matlab
简简单单做算法7 小时前
基于GA遗传优化双BP神经网络的时间序列预测算法matlab仿真
神经网络·算法·matlab·时间序列预测·双bp神经网络
yu85939588 小时前
基于MATLAB的随机振动仿真与分析完整实现
开发语言·matlab
guygg888 小时前
利用遗传算法解决列车优化运行问题的MATLAB实现
开发语言·算法·matlab
gihigo19988 小时前
基于MATLAB实现NSGA-III的土地利用空间优化模型
开发语言·matlab
yu85939589 小时前
MATLAB连续线性化模型预测控制(SL-MPC)
算法·机器学习·matlab
南宫萧幕14 小时前
基于 Luenberger 观测器的 PMSM 无速度传感器 id=0 矢量控制系统 Simulink 建模与实现(一)
算法·matlab·汽车·控制
我爱C编程15 小时前
移动边缘网络中基于双深度QLearning强化学习(DDQL)的高能效资源分配方法
matlab·强化学习·移动边缘网络·双深度qlearning·ddql·高能效资源分配
wei_shuo15 小时前
办公小浣熊Office Raccoon 2.0智能助手:帮助我真正实现数据处理工作中的降本、增效、提质
大数据·ai·数据处理