how to plote 3 variable on 2D plot

5 vues (au cours des 30 derniers jours)
Abdulaziz
Abdulaziz le 10 Avr 2013
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

Réponse acceptée

Ahmed A. Selman
Ahmed A. Selman le 10 Avr 2013
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.

Plus de réponses (0)

Catégories

En savoir plus sur Line Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by