how to plote 3 variable on 2D plot

조회 수: 5 (최근 30일)
Abdulaziz
Abdulaziz 2013년 4월 10일
Hi guys
I have two matrices; one for velocity and the other for depth. these two matrices will generate a curve at particular position where the test was made. Similarly, at every x(i) position we have different curve from different data. I am trying to plot 2D (velocity VS depth) at all position but on the same plot. The problem is I want the x axis to present the velocity and axial distance x(i) and y present the depth. example x=[ 0,1,2,3,4] and at every x value we have D matrix and V matrix. The plot should draw this matrices at every element of x.
Thanks in advance Aziz

채택된 답변

Ahmed A. Selman
Ahmed A. Selman 2013년 4월 10일
But the single x-axis can't hold more than one variable, unless:
  • The two (or more) variables have the same units, as the radius of a sphere (R) and the outward distance (D) from the surface of that sphere, or
  • The two (or more) variables are coupled by a linear equation, as the radius of a sphere (R) and the circumference of that sphere (C=2*pi*R). In this case the scale units might be (arbitrary).
None of these cases apply to your question, since you have velocity (units of length/time) and depth, or axial distance (units of length).
There is a way around it, that is to use two y-axes on a single x-axis (x and V, x and D). For such case use
plotyy(x1, D, x2, V)% two x-axes, two y-axes. Or
plotyy(x, D, x, V)% one x-axes, two y-axes.
and always note that (x, D and V) must have the same sizes.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by