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

相关推荐
程高兴3 小时前
三相两电平光伏MPPT定步长扰动观察法Simulink
matlab
躺柒5 小时前
读数据可视化10数据(下)
信息可视化·数据分析·可视化·数据可视化·大数据分析
CAE32010 小时前
BPM-Matlab光束传播法光学仿真
matlab·bpm·光束传播法
十三画者1 天前
【文献分享】ConfRetro:融合3D构象信息的逆合成预测Transformer框架
人工智能·深度学习·数据挖掘·数据分析·transformer·数据可视化
Evand J1 天前
【MATLAB例程,车联网8】MPC网联车辆节能跟驰控制:速度跟踪、间距约束与能耗优化。附MATLAB完整代码的下载链接
开发语言·matlab·车联网·调度·mpc·节能·车辆控制
阿 才1 天前
Matlab(Simulink)使用详解
运维·网络·matlab
Evand J1 天前
【MATLAB例程,车联网12】基于模型预测控制(MPC)的网联车辆交叉口生态驾驶动态优化仿真分析。附完整代码的下载链接
物联网·matlab·车联网·mpc·模型预测控制·车辆·网联车辆
民乐团扒谱机1 天前
【微实验】线性代数之——奇异值分解 SVD:穿透数据迷雾的“X光机”,附 MATLAB 全流程仿真
线性代数·算法·matlab
majorArcs2 天前
MATLAB 绘制论文级双重饼图:2024 高教社杯 C 题实战
matlab
躺柒2 天前
读数据可视化08数据(上)
大数据·信息可视化·数据分析·数据可视化·视觉·可视化分析