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

相关推荐
yong99907 小时前
带挂载的四轴飞行器模型预测控制(MPC) MATLAB实现
开发语言·matlab
yongui478347 小时前
MATLAB小波变换图像融合
opencv·计算机视觉·matlab
maverick_1118 小时前
【FPGA】关于两个数相加的“坑”
c语言·matlab·fpga开发
88号技师12 小时前
2026年3月新锐一区SCI-随机社会学习优化算法Stochastic social learning-附Matlab免费代码
学习·算法·数学建模·matlab·优化算法
88号技师13 小时前
2025年11月一区SCI-壁虎优化算法Gekko Japonicus Algorithm-附Matlab免费代码
开发语言·算法·数学建模·matlab·优化算法
杨超越luckly14 小时前
HTML应用指南:利用GET请求获取中国生活垃圾焚烧发电厂位置信息
python·arcgis·html·数据可视化·生活垃圾焚烧发电厂
软件算法开发14 小时前
基于人工势场法的多无人机协同飞行路径规划与避障系统matlab仿真
matlab·无人机·人工势场法·多无人机协同·飞行路径规划
乌恩大侠1 天前
【KrakenSDR】MATLAB接口
服务器·网络·matlab
feifeigo1231 天前
近场声全息(NAH)数据与MATLAB实现
开发语言·matlab
fie88891 天前
基于MATLAB的非线性模型预测控制(NMPC)在CSRT系统中的应用
开发语言·matlab