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

相关推荐
简简单单做算法16 小时前
基于Qlearning强化学习的免授权频谱下NR-U与WiFi共存资源最优分配策略matlab仿真
matlab·wifi·qlearning·免授权频谱·nr-u·资源最优分配
wearegogog12318 小时前
光伏发电系统最大功率跟踪(MPPT)算法 Matlab 实现指南
开发语言·算法·matlab
slandarer19 小时前
MATLAB | R2026a 更新了哪些有趣的新东西?
开发语言·数据库·matlab
gihigo199820 小时前
MATLAB地震面波数值模拟方案
开发语言·matlab
可编程芯片开发20 小时前
基于Voronoi自适应分区的Qlearning强化学习粒子群算法的海上风电场电气系统拓扑优化matlab仿真
matlab·voronoi·qlearning·拓扑优化·自适应分区·海上风电场
关岭风尘21 小时前
Matlab/Simulink - BLDC直流无刷电机仿真基础教程(九) - BLDC电机滑行状态低占空比启动波形分析
matlab·电机控制·bldc仿真·电机续流·滑行启动
Not Dr.Wang4221 天前
基于matlab的控制系统奈氏图及其稳定性分析
数据结构·算法·matlab
GIS地信小匠1 天前
(31)ArcGIS Pro 定义投影与批量投影:矢量数据坐标转换工具实操
arcgis·空间分析·数据处理·gis教程·arcgls pro
machnerrn2 天前
matlab实现直流伺服电机 PID 控制系统仿真系统(含源码+资料报告+说明文档等)
开发语言·matlab
破阵子443282 天前
MATLAB 下载安装教程
matlab