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

相关推荐
Highcharts.js12 小时前
五大痛点拖慢数据分析平台决策效率:Highchart可视化与AI分析解决方案解析
人工智能·信息可视化·数据分析·数据可视化·highcharts·ai可视化分析
chhttty2 天前
MAB建模规范:Simulink外观规范
matlab·simulink
机器学习之心3 天前
CCD实验设计+SVM代理建模+改进NSGA-II工艺参数多目标优化,MATLAB代码
算法·支持向量机·matlab·多目标优化
泛泛7辈3 天前
通过matlab训练和验证深度学习的目标检测
深度学习·目标检测·matlab
金銀銅鐵3 天前
用 WBS 来表示《倚天屠龙记》中明教的主要结构
数据可视化
daad7773 天前
记录matlab状态机demo
java·网络·matlab
吃好睡好便好3 天前
MATLAB中图像的线性变换
开发语言·图像处理·学习·计算机视觉·matlab
熊猫_豆豆3 天前
《基于改进标准映射的图像加密算法》MATLAB代码版本
开发语言·matlab·图像加密算法
吃好睡好便好4 天前
MATLAB中图像的对数变换
图像处理·学习·算法·计算机视觉·matlab
爱吃提升4 天前
MATLAB矩阵运算完全指南:从生成到索引操作
数据结构·matlab·矩阵