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

相关推荐
柳杉2 小时前
Codex + 可视化大屏工作流实践:15 个行业场景的设计产出合集
前端·openai·数据可视化
机器学习之心7 小时前
DCNN-PINN锂电池SOC估计,因果空洞卷积+物理信息神经网络,把库仑定律写进损失函数,MATLAB代码
人工智能·神经网络·matlab
weixin_3077791316 小时前
C++代码实现MATLAB中的crossval函数功能
开发语言·c++·算法·matlab
菜鸟~noob23318 小时前
【电子战】 第22篇:误差椭圆与置信区间【含matlab代码】
开发语言·算法·matlab
weixin_3077791319 小时前
C++代码实现MATLAB中的normalize函数功能
开发语言·c++·算法·matlab
素是1 天前
simulink中data memory不能设置为全局变量
matlab
海天一色y1 天前
深入理解对偶单纯形法:原理推导与 Python/MATLAB 编程实现
python·matlab·最优化算法·对偶单纯形法
茗创科技2 天前
Nature Mental Health | 基于皮层相似性网络分析,揭示神经性厌食症的神经机制
matlab·数据分析·脑网络
李日华大战鸡红2 天前
滑膜观测器(学习记录)
stm32·单片机·学习·matlab·机器人
菜鸟~noob2332 天前
【电子战】第21篇:扩展卡尔曼滤波(EKF)与动态跟踪【含matlab代码】
matlab·电子战