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

相关推荐
Evand J1 天前
【matlabfilter例程】二维平面的雷达测角+测距目标跟踪,单个雷达,KF融合雷达和IMU数据。轨迹绘图、误差绘图输出。附代码下载链接
matlab·雷达·卡尔曼滤波·kf·跟踪·kalman·二维
爱尔兰的楠小楠1 天前
matlab/simulink与WLS2下ROS2联合仿真环境搭建
matlab·机器人·ros·px4
Dev7z1 天前
基于OpenCV和MATLAB的椭圆检测系统的设计与实现
人工智能·opencv·matlab
用户41429296072391 天前
淘宝实时商品API接口:采集竞品商品详情页的价格、SKU 规格、库存数量、卖点文案、图文内容、售后政策(运费、退换货规则)、评价核心标签
数据挖掘·数据分析·数据可视化
杨超越luckly2 天前
基于 Overpass API 的城市电网基础设施与 POI 提取与可视化
python·数据可视化·openstreetmap·电力数据·overpass api
Learn Beyond Limits2 天前
Data Preprocessing|数据预处理
大数据·人工智能·python·ai·数据挖掘·数据处理
用户5962585736062 天前
【征文计划】当AI Glasses成为你的“植物百科全书”
数据可视化
东荷新绿3 天前
MATLAB 2018a 安装教程:30分钟搞定安装
开发语言·matlab·matlab2018a
jllllyuz4 天前
Matlab实现基于Matrix Pencil算法实现声源信号角度和时间估计
开发语言·算法·matlab
Dev7z4 天前
基于Matlab传统图像处理的风景图像多风格转换与优化
图像处理·matlab·风景