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

相关推荐
Dev7z4 小时前
基于Matlab传统图像处理的风景图像多风格转换与优化
图像处理·matlab·风景
HsuHeinrich12 小时前
利用面积图探索历史温度的变化趋势
python·数据可视化
t1987512821 小时前
基于MATLAB的指纹识别系统完整实现
开发语言·matlab
gihigo19981 天前
基于MATLAB的IEEE 14节点系统牛顿-拉夫逊潮流算法实现
开发语言·算法·matlab
云纳星辰怀自在1 天前
MATLAB: m脚本-fixdt数据类型数据范围
matlab·m脚本·fixdt
一叶知秋h1 天前
matlab实现PID参数功能的简单仿真_gif
matlab·gif·pid
技术净胜1 天前
MATLAB 基因表达数据处理与可视化全流程案例
开发语言·matlab
wangDer_me1 天前
字节数组不同格式下的转换与处理
数据·数据处理·字节数组
机器学习之心1 天前
SSA-SVMD麻雀算法优化逐次变分模态分解(15种不同的适应度)MATLAB代码
matlab·ssa-svmd·麻雀算法优化逐次变分模态分解
三维空间1 天前
在MATLAB中对基因表达数据进行数据预处理
matlab