cwlr.net
当前位置:首页 >> mAtlAB画图两个纵坐标 >>

mAtlAB画图两个纵坐标

A = [1 2 3 3 4 5 5 5]; ua = unique(A); ct = size(ua,2); for k = 1:ct c = sum(A==ua(k)); SM(k) = c PD(k) = c/size(A,2); end; plotyy(ua,SM,ua,PD);

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

x=-2*pi:pi/10:2*pi; y=sin(x); z=3*cos(x); plotyy(x,y,x,z) http://baike.baidu.com/view/3864997.html?fromTaglist http://luobo.ycool.com/post.887916.html

>>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);

需要对坐标系句柄分别进行设置,注意这种作图会产生两个坐标系,我画了两条曲线,坐标范围是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>>...

用plotyy,例如: x = 0:0.01:20; y1 = 200*exp(-0.05*x).*sin(x); y2 = 0.8*exp(-0.5*x).*sin(10*x); [AX,H1,H2] = plotyy(x,y1,x,y2,'plot'); set(get(AX(1),'Ylabel'),'String','Slow Decay') %左侧y轴 set(get(AX(2),'Ylabel'),'String','Fa...

alpha=0:0.01:pi/2; t1=286*sin(2*alpha)/2; m1=286*(cos(alpha)-cos(alpha).^3); x1=633+286*cos(2*alpha)/2; [AX,H1,H2]=plotyy(x1,t1,x1,m1); set(H2,'LineStyle','--'); set(AX,'XTick',[]); set(AX,'YTick',[]); hold on t2=400*sin(2*alph...

可以用一个循环,假设x轴数据存储在x中,y轴数据存储在y中,另设两个变量a和b分别存储各张图像的x和y的数据for i=1:na(i,:)=x;b(i,:)=y;end这样a和b的每一行都存储对应x坐标和y坐标的数据,前提是每次存储的数据长度必须等长,否则matlab可能会报错

>> 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 ...

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];...

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