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

相关推荐
chao1898444 小时前
基于 SPEA2 的多目标优化算法 MATLAB 实现
开发语言·算法·matlab
yongui4783411 小时前
基于 GA 优化的 BP 神经网络算法分析与 MATLAB 实现
神经网络·算法·matlab
rit843249912 小时前
基于 MATLAB 的坐标变换程序
开发语言·matlab
listhi52012 小时前
LTE标准下Turbo码编译码仿真
算法·matlab
fie888913 小时前
城市环境下车辆目标跟踪算法 MATLAB 实现
算法·matlab·目标跟踪
机器学习之心13 小时前
轴承剩余寿命预测 | 基于BP神经网络的轴承剩余寿命预测MATLAB实现!
人工智能·神经网络·matlab·轴承剩余寿命预测
Evand J14 小时前
【无人机编队控制程序4】复杂障碍环境下多无人机编队避障(人工势场法APF)与协同控制,MATLAB仿真例程
开发语言·matlab·无人机·控制·apf·避障
盼兮15 小时前
用AI编程从零搭建一个响应式数据看板
前端·人工智能·数据可视化
南宫萧幕15 小时前
基于 MATLAB 的插电混动汽车 CD-CS 策略 WLTC 前向仿真实现
开发语言·matlab·汽车
yugi98783817 小时前
主动噪声控制中的 FXLMS 算法研究与 MATLAB 实现
开发语言·算法·matlab