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

相关推荐
沅_Yuan12 小时前
基于LSTM神经网络的锂电池SOH估算模型(NASA数据集)【MATLAB】
神经网络·机器学习·matlab·锂电池·nasa·soh
沅_Yuan13 小时前
基于KAN神经网络的锂电池SOH估算模型(NASA数据集)【MATLAB】
神经网络·机器学习·matlab·锂电池·nasa·soh
简简单单做算法15 小时前
基于PSO粒子群优化的Transformer-BiLSTM网络模型的时间序列预测算法matlab性能仿真
matlab·transformer·时间序列预测·bilstm·pso粒子群优化
ueotek15 小时前
Ansys Zemax | 在 MATLAB 或 Python 中使用 ZOS-API 进行光线追迹的批次处理
python·matlab·ansys·zemax·光学软件
全栈开发圈15 小时前
新书速览|MATLAB数据分析与可视化实践:视频教学版
开发语言·matlab·数据分析
爱代码的小黄人16 小时前
MATLAB中for循环实现递减遍历(通用方法)
开发语言·matlab
Evand J16 小时前
【MATLAB代码介绍】使用EKF融合惯导和DVL(速度)的MATLAB仿真例程
matlab·ekf·滤波·定位·导航·卡尔曼滤波·非线性滤波
南宫萧幕16 小时前
自动控制原理|稳定性与劳斯判据 知识点+计算题+MATLAB实现全套笔记
笔记·matlab·控制
王霸天18 小时前
💥大屏卡成 PPT?这 3 个性能优化招数亲测有效
前端·vue.js·数据可视化
神仙别闹19 小时前
基于 MATLAB 实现的图像信号处理
开发语言·matlab·信号处理