how to plote 3 variable on 2D plot

4 views (last 30 days)
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

Accepted Answer

Ahmed A. Selman
Ahmed A. Selman on 10 Apr 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.

More Answers (0)

Categories

Find more on Line Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!