plotyy two variables one with two series

조회 수: 1 (최근 30일)
Abdulaziz
Abdulaziz 2013년 10월 26일
댓글: Image Analyst 2013년 10월 27일
Hi All, Please is it possible to use plotyy to plot two variables, temperature and speed, but for the speed coordinate I need to plot two series u and v. If it is possible, please how to do this.

채택된 답변

sixwwwwww
sixwwwwww 2013년 10월 27일
Dear Abdulaziz, yes you can plot it. The following is an illustration of it:
temparature = 1:100;
u = rand(1, 100);
v = rand(1, 100);
plotyy(temparature, u, temparature, v), legend('u plot', 'v plot')
I hope it helps. Good luck!
  댓글 수: 1
Image Analyst
Image Analyst 2013년 10월 27일
If u and v have similar ranges, you can use plot(t, u, t, v) instead of plotyy(). plotyy() would be used if you have wildly different ranges for u and v, or if you wanted axes with tick marks on both sides of the plot.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2013년 10월 27일
Look at this example
t=0:0.1:10;
y=2*cos(t).^2
u=sin(t); % speed 1
v=cos(t) % speed 2
[ax,h1,h2]=plotyy(t,y,t,u)
line(t,v,'color',[1 1 0],'parent',ax(2));

카테고리

Help CenterFile Exchange에서 Two y-axis에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by