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

相关推荐
guygg885 小时前
基于数据驱动的模型预测控制电力系统机组组合优化MATLAB实现
开发语言·matlab
happy_baymax6 小时前
三电平矢量表达式MATLAB实现
开发语言·matlab
小白小宋7 小时前
PRACH 前导序列生成详解与Matlab实现
5g·matlab·信息与通信·信号处理
t198751287 小时前
基于深度学习的图像分割MATLAB实现
人工智能·深度学习·matlab
Evand J11 小时前
【MATLAB例程】多无人机协同巡逻仿真:基于长机-僚机模型的编队保持与串级PID控制
开发语言·matlab·无人机·控制·pid·串级pid
3GPP仿真实验室1 天前
【MATLAB源码】感知:CFAR 检测算法库
算法·matlab·目标跟踪
Evand J1 天前
【MATLAB教程】在matlab中,gscatter和scatter两个命令的区别
开发语言·matlab·教程·绘图·命令·教学
程高兴1 天前
模糊PID控制的永磁同步电机矢量控制系统-SIMULINK
matlab·1024程序员节
一颗烂土豆1 天前
拒绝 rem 计算!Vue3 大屏适配,我用 vfit 一行代码搞定
vue.js·响应式设计·数据可视化
leo__5201 天前
MATLAB高斯背景建模与目标提取(人体检测)
开发语言·人工智能·matlab