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

相关推荐
foundbug9991 小时前
直流电机 PID 速度控制 MATLAB 仿真程序
开发语言·matlab
yuan199973 小时前
欧拉梁静力与屈曲计算的 MATLAB 实现(有限差分法 + 解析解)
开发语言·算法·matlab
88号技师8 小时前
2026年2月一区SCI-交叉传播优化算法Propagation Alongside Crossover-附Matlab免费代码
开发语言·算法·数学建模·matlab·优化算法
ytttr8738 小时前
航天器姿态控制 MATLAB 仿真程序
开发语言·matlab
feifeigo12310 小时前
基于多混沌映射的图像加密(MATLAB实现)
开发语言·matlab
简简单单做算法11 小时前
基于LEO卫星的多波束通信技术matlab性能仿真
matlab·leo卫星·多波束通信
chao18984411 小时前
GNSS软件接收机 MATLAB 实现(GPS L1 CA码)
开发语言·matlab
yong999012 小时前
IMU 扩展卡尔曼滤波(EKF)姿态估计 — MATLAB 实现
开发语言·matlab
我爱C编程13 小时前
基于遗传优化和GDOP评价的5G微基站部署策略matlab仿真
5g·matlab·遗传优化·gdop·5g微基站部署
m0_547486661 天前
《数字图像处理:使用MATLAB分析与实现》全套课件PPT
开发语言·matlab·powerpoint