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

相关推荐
我爱C编程5 小时前
基于FCM聚类法和LS最小二乘法的T-S模糊模型参数辨识matlab仿真
matlab·聚类·最小二乘法·fcm聚类法·t-s模糊模型·参数辨识
杰瑞不懂代码8 小时前
基于 MATLAB 的 BPSK/QPSK/2DPSK 在 AWGN 信道下的 BER 性能仿真与对比分析
开发语言·matlab·qpsk·2psk·2dpsk
ytttr8739 小时前
MATLAB中CVX凸优化工具箱的使用指南
开发语言·matlab
stars-he11 小时前
单相可控整流电路的MATLAB仿真设计(2)
开发语言·matlab
Evand J13 小时前
【MATLAB例程】三维环境下,EKF融合INS与DVL的核心程序,用于惯导和速度传感器的数据融合滤波。附下载链接
开发语言·matlab
databook14 小时前
格式塔原理:数据可视化如何引导观众的注意力
python·数据分析·数据可视化
Joe_Blue_0216 小时前
Matlab入门案例介绍—常用的运算符及优先级
开发语言·数据结构·matlab·matlab基础入门案例介绍
Joe_Blue_0218 小时前
Matlab 入门案例介绍——如何创建脚本
开发语言·matlab·matlab 入门案例
nwsuaf_huasir18 小时前
积分旁瓣电平-matlab函数
前端·javascript·matlab
崇山峻岭之间18 小时前
Matlab学习记录20
开发语言·学习·matlab