当前位置:网站首页>Using stairs function in MATLAB
Using stairs function in MATLAB
2022-06-12 11:10:00 【jk_ one hundred and one】
Catalog
At the designated x Value position plots a single data sequence
At the designated x Value to plot multiple data sequences
In the only x Draw multiple data sequences at a set of values
Specify the line type 、 Marking symbols and colors
Specify the coordinate area for the ladder diagram
Create and modify ladder diagrams
Use the drawing function to create a ladder diagram
stairs The function is used to draw a ladder diagram
grammar
stairs(Y)
stairs(X,Y)
stairs(___,LineSpec)
stairs(___,Name,Value)
stairs(ax,___)
h = stairs(___)
[xb,yb] = stairs(___)explain
stairs(Y) draw Y Ladder diagram of elements in .
If Y Vector , be stairs Draw a line .
If Y For matrix , be stairs Draw a line for each matrix column .
stairs(X,Y) stay Y Zhongyou X Draw the element at the specified position . Input X and Y Must be a vector or matrix of the same size . in addition ,X It can be a row or column vector ,Y Must contain length(X) Matrix of rows .
stairs(___,LineSpec) Specify the line type 、 Marking symbols and colors . for example ,':*r' Specify the red dotted line marked with an asterisk . You can use this option in combination with any of the input parameters in the previous syntax .
stairs(___,Name,Value) Use one or more names - Value to modify the ladder diagram for group parameters . for example ,'Marker','o','MarkerSize',8 The specified size is 8 A round mark of pounds .
stairs(ax,___) Draw the graph to ax In the specified coordinate area , Instead of the current coordinate area (gca) in . Options ax It can precede any combination of input parameters in the previous syntax .
h = stairs(___) Returns one or more Stair object . Creating a specific Stair After the object , Use h Change the properties of the object .
[xb,yb] = stairs(___) Do not create drawings , But return a matrix of equal size xb and yb, In order to make plot(xb,yb) Draw a ladder .
Example
Draw single data sequence
Created in 0 To 4π In the interval 40 Sinusoidal ladder diagram calculated at uniformly distributed values .
X = linspace(0,4*pi,40);
Y = sin(X);
figure
stairs(Y)
Y The length of is automatically determined and generated x Axis scale .
Draw multiple data sequences
Created in 0 To 4π In the interval 50 A ladder graph of two cosine functions calculated at values of uniform distribution .
X = linspace(0,4*pi,50)';
Y = [0.5*cos(X), 2*cos(X)];
figure
stairs(Y)
Y The number of rows in is automatically determined and generated x Axis scale .
At the designated x Value position plots a single data sequence
Created in 0 To 4π Step diagram of sine wave calculated at values uniformly distributed in the interval . Specify the x Value set .
X = linspace(0,4*pi,40);
Y = sin(X);
figure
stairs(X,Y)
draw Y Item pairs in X Figure of the corresponding item in .
At the designated x Value to plot multiple data sequences
Created in 0 To 4π Two cosine wave step diagrams calculated at the values of uniform distribution in the interval . Specify the x Value set .
X = linspace(0,4*pi,50)';
Y = [0.5*cos(X), 2*cos(X)];
figure
stairs(X,Y)
The first vector input X Determine the... Of two data sequences x Axis position .
In the only x Draw multiple data sequences at a set of values
Create a ladder diagram of two cosine waves calculated at different values . Specifies the unique... Used to plot each data sequence x Value set .
x1 = linspace(0,2*pi)';
x2 = linspace(0,pi)';
X = [x1,x2];
Y = [sin(5*x1),exp(x2).*sin(5*x2)];
figure
stairs(X,Y)
draw X Each column pair of Y Graph of the corresponding column of .
Specify the line type 、 Marking symbols and colors
Create a ladder diagram , Set the linetype to dash dot , Set marker symbol to circle , Set the color to red .
X = linspace(0,4*pi,20);
Y = sin(X);
figure
stairs(Y, '-.or')
Specify other style options
Use Name,Value Create a ladder diagram for the group parameter and set the line weight to 2, Set the marker symbol to diamond , And set the color of the marking surface to cyan .
X = linspace(0,4*pi,20);
Y = sin(X);
figure
stairs(Y,'LineWidth',2,'Marker','d','MarkerFaceColor','c')
Specify the coordinate area for the ladder diagram
from R2019b Start , have access to tiledlayout and nexttile Function to display block diagram . call tiledlayout Function to create a 2×1 Block diagram layout . call nexttile Function to create a coordinate area object ax1 and ax2. By specifying the coordinate area object as stairs The first parameter of , Create a separate ladder diagram in the coordinate area .
x = linspace(0,2*pi);
y1 = 5*sin(x);
y2 = sin(5*x);
tiledlayout(2,1)
% Top plot
ax1 = nexttile;
stairs(ax1,x,y1)
% Bottom plot
ax2 = nexttile;
stairs(ax2,x,y2)
Create and modify ladder diagrams
Create a ladder diagram of two data sequences and return two ladder diagram objects .

Use a small circular marker for the first data sequence . Fill the second sequence with magenta circles . Use dot notation to set properties .
h(1).Marker = 'o';
h(1).MarkerSize = 4;
h(2).Marker = 'o';
h(2).MarkerFaceColor = 'm';
Use the drawing function to create a ladder diagram
stay 0 and 4π In the interval 50 Computes two cosine functions at values that are uniformly distributed and uses plot Create a ladder diagram .
X = linspace(0,4*pi,50)';
Y = [0.5*cos(X), 2*cos(X)];
[xb,yb] = stairs(X,Y);stairs Returns two matrices of equal size xb and yb, But no drawings .
Use plot It can be done by xb and yb Create a ladder diagram .
figure
plot(xb,yb)
边栏推荐
- MATLAB中stairs函数使用
- 疫情居家办公体验 | 社区征文
- SharDingJDBC-5.1.0按月水平分表+读写分离,自动创表、自动刷新节点表
- k53.第二章 基于二进制包安装kubernetes v1.22 --集群部署
- 【clickhouse专栏】基础数据类型说明
- Set SVG color
- Leetcdoe 2037. Make each student have the minimum number of seat movements (yes, once)
- The solution of Lenovo notebook ThinkPad t440 WiFi unable to connect to the Internet
- InfoQ geek media's 15th anniversary solicitation |position:fixed virtual button cannot take effect after being triggered. Problem analysis and Solution Exploration
- Grid layout
猜你喜欢

redis 总结

分布式存储探索

logrotate日志轮转方式create和copytruncate原理

AcWing 135. 最大子序和(前缀和 + 单调队列求定长区间最小值)

M-Arch(番外12)GD32L233评测-CAU加解密(捉弄下小编)

Building 64 bit wampserver and DVWA in win7 virtual machine

Telecommuting with cpolar (2)

The reason why scanf return value is ignored and its solution

Leetcode 2169. Get operands of 0

On 3dsc theory and application of 3D shape context feature
随机推荐
Principle analysis of vite HMR
PHP can load different new data methods for each refresh
Construction and construction of meta Universe System
MYSQL——内置函数
A simple understanding of b+ tree
SOT23(Small Outline Transistor)
Pseudo static setting of access database in win2008 R2 iis7.5
InfoQ geek media's 15th anniversary solicitation |position:fixed virtual button cannot take effect after being triggered. Problem analysis and Solution Exploration
MySQL performance test (slow query log)
k52.第一章 基于kubeadm安装kubernetes v1.22 -- 集群部署
Stream as a return value in WCF - who disposes of it- Stream as a return value in WCF - who disposes it?
力扣(LeetCode)162. 寻找峰值(2022.06.11)
AcWing 1921. 重新排列奶牛(环图)
Common methods of string class
M-Arch(番外13)GD32L233评测-来点音乐
Vite Basics
Mysql5.6.24 installation free deployment method
FPGA key experiment
Leetcode 2169. Get operands of 0
The most detailed explanation of the top ten levels of sqli labs platform