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

相关推荐
彬鸿科技1 小时前
bhSDR Studio/Matlab入门指南(十):OFDM 数字通信实验界面全解析
人工智能·matlab·信息与通信·软件定义无线电
2CM_Embed2 小时前
电脑打开 Simulink 很慢怎么办?MATLAB / Simulink 启动慢的完整解决方法
matlab·simulink
guygg882 小时前
用 MATLAB 实现步进电机控制的仿真方案
开发语言·matlab
yuan199972 小时前
基于物理光学(波动光学)模型的 MATLAB 程序
开发语言·matlab
SZLSDH20 小时前
当数字孪生陷入“交付即闲置”困境:从重建设到重运营的路径选择
ai·数字孪生·数据可视化·智能体
南屹川1 天前
【大数据】大数据处理技术栈:从采集到分析的完整链路
大数据·人工智能·hadoop·flink·spark·数据处理
吃好睡好便好1 天前
提取矩阵某几行和某几列元素
人工智能·学习·线性代数·算法·matlab·矩阵
nwsuaf_huasir1 天前
RD图绘制-雷达回波模拟-距离多普勒图绘制
算法·matlab·语音识别
加成BUFF1 天前
《机器人学》MATLAB 机器人工具箱 应用指南一
机器学习·matlab·机器人·机器人工具箱
懒惰的coder1 天前
LQR控制算法
matlab