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

相关推荐
leo__5204 小时前
MATLAB实现牧羊人算法
开发语言·算法·matlab
leo__5205 小时前
MATLAB实现UKF(无迹卡尔曼滤波)原理
人工智能·matlab
fie88895 小时前
LBP + HOG 特征检测与识别 MATLAB 实现
数据结构·算法·matlab
feifeigo1235 小时前
马尔可夫决策过程(MDP)MATLAB 实现
开发语言·matlab
飞舞哲7 小时前
三维点云最小二乘拟合MATLAB程序
开发语言·算法·matlab
jllllyuz7 小时前
HVDC 高压直流输电系统 MATLAB/Simulink 仿真全集
开发语言·matlab
阿里matlab建模师10 小时前
【机场停机位分配】matlab实现基于遗传算法的机场停机位分配优化研究
开发语言·算法·数学建模·matlab·全国大学生数学建模竞赛
一晌小贪欢10 小时前
第22节:相关性分析——协方差、相关系数与热力图解读
开发语言·python·数据分析·pandas·数据可视化
神仙别闹1 天前
基于 MATLAB DCT 的图像编码器并进行调试分析
matlab
chhttty1 天前
《Simulink嵌入式开发实战》新书上市
matlab·simulink