0
$\begingroup$

Two functions both change with the same independent variable t, there is another variable represent different groups (z). how to plot y[t] versus x[t] with each group of z represented by one independent curve. See example equation below, with z as a separate integer variable that varies while t is a continuous variable. Please note I do not plan to use Manipulate function.

x[z_][t_] := z/5*Exp[-0.1*t]
y[z_][t_] := 500/(2 + x[t])
z={1,2,5,10,20}
ParametricPlot[{Evaluate[x[z][t]],Evaluate[y[z][t]},{x,0,100},{z,zlist},AspectRatio -> 1]
$\endgroup$

1 Answer 1

2
$\begingroup$

You'll want to use Table within ParametricPlot to plot multiple curves.

There are a few issues with your code. 1) The definition of y[z][t] refers to x[t] not x[z][t]. 2) zlist isn't defined. 3) The syntax of ParametricPlot doesn't take anything like {z, zlist}.

This works:

x[z_][t_] := z/5*Exp[-0.1*t]
y[z_][t_] := 500/(2 + x[z][t])

ParametricPlot[
  Evaluate[Table[{x[z][t], y[z][t]}, {z, {1, 2, 5, 10, 20}}]]
, {t, 0, 100}, AspectRatio -> 1]

Mathematica graphics

All the curves overlap, because they're all variants of y = 500/(2 + x).

$\endgroup$
2
  • 1
    $\begingroup$ Manipulate can help to visualize the overlap: Manipulate[ ParametricPlot[ {{x[20][t], y[20][t]}, {x[z][t], y[z][t]}}, {t, 0, 100}, PlotStyle -> {{LighterBlue, Dashed}, Red}, PlotLegends -> Placed[{20, z}, {.5, .5}], AspectRatio -> 1, PlotRange -> {{0, 4}, {80, 250}}], {z, zlist}] $\endgroup$
    – Bob Hanlon
    May 11, 2019 at 15:28
  • $\begingroup$ This Manipulate function is really helpful. Thank you both. $\endgroup$
    – Math Entry
    May 11, 2019 at 18:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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