cwlr.net
当前位置:首页 >> MATLAB 双纵坐标画图 >>

MATLAB 双纵坐标画图

>>x = 0:0.01:20; >>y1 = 200*exp(-0.05*x).*sin(x); >>y2 = 0.8*exp(-0.5*x).*sin(10*x); >>figure % new figure >>plotyy(x,y1,x,y2);

clear all;close all;clc;x=[50 150 250 350 450 550];cpu1=[ 27.38 39.38 50.78 52.78 52.77 53.17];cpu2=[ 12.34 24.34 33.3 39.54 39.62 48.2]; cpu3=[ 19.39 44.35 52.02 51.43 50.84 52.9];memory1=[ 98.54 98.4 98.62 98.62 98.58 98.57];...

先画一个 plot(x,y1); hold on; 再画剩下两个 plotyy(x,y2,x,y3);

plotyy(x,y1,x,y2,@loglog,@semilogx)

需要对坐标系句柄分别进行设置,注意这种作图会产生两个坐标系,我画了两条曲线,坐标范围是0~0.8,然后把x轴的范围改到0~1: >> ax = plotyy( 0 : 0.1 : 0.8, 0 : 0.1 : 0.8, 0 : 0.1 : 0.8, 0.8 : -0.1 : 0, 'plot' )ax = 173.0369 175.0369>>...

x=0:.1:pi; y1=sin(x); y2=cos(x); y3=tan(x); y4=atan(x); hold on; [AX,hy1,hy2]=plotyy(x,y1,x,y2); [AY,hy3,hy4]=plotyy(x,y3,x,y4); set(hy1,'Color','red'); set(hy2,'Color','blue'); set(hy3,'Color','green'); set(hy4,'Color','yellow');

>> x = 0:0.01:20; >>y1 = 200*exp(-0.05*x).*sin(x); >>y2 = 0.8*exp(-0.5*x).*sin(10*x); >>figure % new figure >>plotyy(x,y1,x,y2);

>> x=15:25; >> yzuo1=[1.4157 1.4157 1.4157 1.4157 1.4157 1.4157 1.4157 1.4157 1.41575 1.4158 1.4159]; >> yzuo2=[1.41355 1.4136 1.41365 1.4137 1.41375 1.4138 1.4139 1.4140 1.4143 1.41475 1.4159]; >> yyou=[-2 -2.4 -2.9 -3.5 -4.2 ...

假设你想将两条曲线画在左侧纵坐标,剩下三条曲线画在右侧纵坐标,示例如下: x = rand(100,1); %模拟5条曲线数据y = [2*rand(100,1),3*rand(100,1),4*rand(100,1),5*rand(100,1),6*rand(100,1)]; figure(1);yyaxis left; %左侧纵坐标p1=plot(x,...

% 用独立双Y轴可以实现,下例: clear all; x = 1985:5:2010; y1 = [2 3 4 5 6 7]; y2 = [1 2 3 4 5 6]; h1 = axes('Position',[0.2 0.2 .6 .6]); line(x,y1,'Color','k','Parent',h1); % 可以用 plot axis([1985 2010 1 7]); grid on; box on; ...

网站首页 | 网站地图
All rights reserved Powered by www.cwlr.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com