How to plot 2 sets of data of different length with a common x axis on a single graph (3D plot)

조회 수: 2 (최근 30일)
Hi Everyone,
I have two sets of data that have the same x axis, but a different 2nd axis/y axis. Is there a way to plot this such that the x axis is the x data, data 1 is on the y axis and data 2 is on the z axis? Oh and the two data sets may not be the same length.
Example: Say you wanted to plot horsepower, torque, and the year of a car - with the year of the car being the common axis, and horse power and torque being data 1 and data 2 as mentioned above.
Thanks for your help, Dan

답변 (1개)

the cyclist
the cyclist 2015년 3월 27일
It seems to me that a 3-dimensional display is not the right idea for this. What about using the plotyy command instead?
  댓글 수: 1
Dan
Dan 2015년 3월 30일
Thanks so much for your response!
After exploring the 'plot3' command in more depth, I was able to achieve what I needed to do. The key was to pad the constant 'x-axis' with an array of ones that matched the size of the y-axis dataset.
That 'plotyy' command is really neat though. I did not know about it beforehand. Thanks for the suggestion!
-Dan

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

카테고리

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