matlab plotyyy
时间: 2023-10-20 20:36:21 浏览: 166
plotyyy.rar_matlab plotyyy_matlab三纵坐标_matlab坐标轴_ploty_三个纵坐标
5星 · 资源好评率100%
"plotyyy" 是一个自定义的 MATLAB 函数,它可以在同一张图中绘制三个 Y 轴的曲线。它的使用方法如下:
```matlab
function [ax,h1,h2,h3]=plotyyy(x1,y1,x2,y2,x3,y3,xlabel,ylabel1,ylabel2,ylabel3,titlestr)
%PLOTYYY - Extends plotyy to include a third y-axis
%
%Syntax: [AX,H1,H2]=PLOTYYY(X1,Y1,X2,Y2,X3,Y3,XLABEL,YLABEL1,YLABEL2,YLABEL3,TITLESTR)
%
%Inputs: X1,Y1 are the data for the first axes (left)
% X2,Y2 are the data for the second axes (right)
% X3,Y3 are the data for the third axes (right)
% XLABEL is the label for the x-axis
% YLABEL1 is the label for the left y-axis
% YLABEL2 is the label for the right y-axis
% YLABEL3 is the label for the third y-axis
% TITLESTR is a string containing the title for the plot
%
%Outputs: AX is a vector of three axes handles
% H1 is the handle for the plot in the first axes
% H2 is the handle for the plot in the second axes
% H3 is the handle for the plot in the third axes
%
%Example:
%
% x=0:0.1:10;
% y1=sin(x);
% y2=exp(-0.1*x).*sin(x);
% y3=exp(-0.2*x).*sin(x);
% [ax,h1,h2,h3]=plotyyy(x,y1,x,y2,x,y3,'time (s)','y1','y2','y3','Example plot');
% legend([h1,h2,h3],'y1','y2','y3');
%
%Author: Denis Gilbert, Ph.D., physical oceanography
%Maurice Lamontagne Institute
%Department of Fisheries and Oceans Canada
%email: gilbertd@dfo-mpo.gc.ca Web: http://www.qc.dfo-mpo.gc.ca/iml/
%January 2000; Last revision: 14-Mar-2000
%modified by Zhanqiao Kang 2022/05/23
```
其中,x1, y1, x2, y2, x3, y3 分别是三个 Y 轴的数据,xlabel, ylabel1, ylabel2, ylabel3, titlestr 分别是 X 轴标签、左 Y 轴标签、右 Y 轴标签和第三个 Y 轴标签以及图像标题。函数会返回三个轴的句柄以及三个曲线的句柄。
阅读全文