I am trying to use ContourPlot to plot an implicit function. Now I have two variables (x,y) implicit function:

(b x)/a + y == ((c + d) Log[1 - (n y)/(c + d)])/m

where b/a=0.0065,c+d=-3276.26 and n=9770.6, m=9770.6x{0,60}. I can ContourPlot it y~x correctly. Physically, x is the time, y is the distance.

Actually, the y has the region {0,k}, now I want to ContourPlot it with y normalized, i.e. the x-axis is the time, y-axis is the distance y divided by k (y/k), ranges from 0 to 1. Just like this "the plot result"

  • 1
    $\begingroup$ "a,b,c,d,m and n are all known", But I do not know anything about them ? $\endgroup$ – Mariusz Iwaniuk Sep 27 '18 at 13:38
  • $\begingroup$ I have updated the parameters in the equation. Thank you for your help! $\endgroup$ – Rick Sep 27 '18 at 13:52
  • 1
    $\begingroup$ Using your numbers the expression ((c + d) Log[1 - (n y)/(c + d)])/m results in an imaginary number whenever y is greater than approximately 0.4. One is unable to plot imaginary numbers directly with Plot or ContourPlot $\endgroup$ – Jack LaVigne Sep 27 '18 at 14:10
  • $\begingroup$ Thank you for your help! $\endgroup$ – Rick Nov 11 '18 at 4:13

Since the scaling is linear, you can simply relabel the ticks:

k = 3;
ContourPlot[x - y^2, {x, 0, 10}, {y, 0, k}, 
  Contours -> {{1, Red}, {2, Green}, {3, Blue}, {4, Purple}}, 
  ContourShading -> None, 
  FrameTicks -> {{Charting`FindTicks[{0, k}, {0, 1}], Automatic},     Automatic}]

enter image description here

Alternatively, multiply all ys by k in the first argument of ContourPlot and use {y, 0, 1} for the y range:

ContourPlot[x - (k y)^2, {x, 0, 10}, {y, 0, 1}, 
  Contours -> {{1, Red}, {2, Green}, {3, Blue}, {4, Purple}}, 
  ContourShading -> None ] 

same picture

  • $\begingroup$ Thank you for your help! $\endgroup$ – Rick Nov 11 '18 at 4:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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