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

相关推荐
jghhh0111 小时前
认知无线电中基于能量检测的双门限频谱感知的 MATLAB 仿真
开发语言·matlab
BT-BOX13 小时前
Matlab 2025B下载安装教程
开发语言·matlab
机器学习之心14 小时前
多工况车速数据集训练LSTM-Attention用于车速预测,输出未来多个时间步车速,MATLAB代码
人工智能·matlab·lstm·lstm-attention·车速预测
Evand J17 小时前
MATLAB绘图函数介绍:plotmatrix绘图,附MATLAB例子
开发语言·matlab·绘图
rit843249917 小时前
基于遗传算法的电动汽车充电站选址优化:模型与MATLAB实现
开发语言·matlab
feifeigo12318 小时前
自适应大邻域搜索(ALNS)算法的MATLAB 实现
开发语言·算法·matlab
fengfuyao98519 小时前
5G网络场景MATLAB仿真方案
matlab
Matlab程序猿21 小时前
【MATLAB源码-第431期】基于MATLAB的六自由度机械臂正逆运动学建模、阻尼逆解与多目标平滑轨迹仿真。
matlab·轨迹规划·逆运动学·正运动学·六自由度机械臂·移动底盘机械臂·阻尼最小二乘
yugi98783821 小时前
MATLAB 实现平板裂纹扩展模拟、气孔/夹杂物分析
开发语言·matlab
EW Frontier2 天前
6G ISAC新范式:基于智能漏波天线的Wi‑Fi通感一体化系统设计与实测【附MATLAB+python代码】
开发语言·python·matlab·music·isac·doa·wi‑fi