Dummy y axis?

조회 수: 2 (최근 30일)
Samir
Samir 2019년 1월 30일
답변: Samir 2019년 2월 2일
Hi, I have data as bellow
x = [ 0 1 2 3 4 5 6 7 8 9 10]
V= [0 2 4 6 8 10 12 14 16 18 20]
I=V/0.5;
I wan to plot (x,V), and (x,I) on the same plot, now since both v and I carry same information all I want is to plot only (x,V) and show another Y axis on right corresponding to I.
Think of it as if you plot a variable say pressure (P) with tepmerature (t), plot (t,P) but you want two Y axis representing pressure in two different units say. mbar and torr. Am I able to explain myself?

채택된 답변

Samir
Samir 2019년 2월 2일
This is what I wanted, check this file.
Let me know if there is a cleaner native matlab way of doing this.
Best Regards
Samir

추가 답변 (1개)

madhan ravi
madhan ravi 2019년 1월 30일
  댓글 수: 8
Samir
Samir 2019년 1월 30일
편집: Samir 2019년 1월 30일
I understand but this is just an example, the tick labels wont be the same every time. I want the plot to read x and V from the variables which may vary in every iteration and so can I which is supposed to be on the right Y axis. Also the relationship can be complicated then presented. So I wan something similar to plotyy(x,V,x,I) but there is no need for two lines. Jsut want to present I on right Y axis so one can read either V or I from the same plot.
Samir
Samir 2019년 1월 30일
편집: Samir 2019년 1월 30일
think of it as if you plot a variable say pressure (P) with tepmerature (t), plot (t,P) but you want two Y axis representing pressure in two different units say. mbar and torr. Am I able to explain myself?

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

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by