Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a velocity profile for two liquids on top of each other in a pressure driven channel. The profile is supposed to be parabolic. I plotted them up, but I can't manage to plot them in the x-y plane, it only plots with velocity on the vertical coordinate and y as the horizontal coordinate. Is there any way I can plot them in the x-y plane so that I can clearly see which liquid is ahead of the other in the channel and their parabolic profile? I am also trying to define v1 on a certain interval from y=0 to y=ha, and v2 from y=ha to y=H, so v1 and v2 are sort of piecewise.

Here is my code, this is for mercury(just to start somewhere) and water

v1[y_, μ1_, P_, ha_, H_, μ2_] :=
  P*(1/(2*μ1))*y*(y + ((ha^2*(μ2 - μ1) - H*μ2)/(ha*(μ2 - μ1) + H*μ1)))

v2[y_, μ1_, P_, ha_, H_, μ2_] :=
  P*(1/(2*μ2))*(y^2 + ((ha^2*(μ2 - μ1) - H*μ2)/(ha*(μ2 - μ1) + H*μ1))* y +
   (ha *  H/μ1)*( (μ1 - μ2)*(H*μ2 - ha * μ1)/(ha*(μ2 - μ1) + H*μ1 )))

Plot[{v1[y, 0.00157, -6, 1, 2, 0.001], v2[y, 0.00157, -6, 1, 2, 0.001]}, {y, 0, 10}]

Velocity vs y


share|improve this question
So you need position rather than velocity - NIntegrate? Please note your code will be much easier to read if you didn't use Greek letters. – Verbeia Feb 20 '13 at 3:09
No time since its steady state – l3win Feb 20 '13 at 3:19
Can you clarify what you mean by "plot in the x-y plane"? Do you need velocity to be on the horizontal axis? Or you just need to shift the curves? It'd be best to make a quick sketch in MS Paint and post it as illustration. I can see that people are confused about what you mean by velocity profile. I believe I understand that, but I also don't understand what you need exactly. – Szabolcs Feb 20 '13 at 3:21
I have made a paint figure. Of course I don't need the arrows. – l3win Feb 20 '13 at 3:30
I guess I have to rotate my graph and somehow split V1 and V2 to two intervals. – l3win Feb 20 '13 at 3:32
up vote 4 down vote accepted

How about using ParametricPlot?

ParametricPlot[{{v1[y, 0.00157, -6, 1, 2, 0.001], 
   y}, {v2[y, 0.00157, -6, 1, 2, 0.001], -y}}, {y, 0, 10}, 
 AspectRatio -> 1/GoldenRatio, PlotStyle -> Black, Frame -> True]

Mathematica graphics

For more precise control, you may need two separate ParametricPlots and combine the output using Show[plot1, plot2, PlotRange -> All].

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.