1
$\begingroup$

How can I plot a function to output a graph, that is defined on the x-axis by various instances of a fixed constant value x, where x is not a machine defined number?

For example,

Plot[2 + x b, {x, b/2, 2 b}]

is expected to plot a graph for various values of x, with x = b / 2 as min, and x = 2 b as max values respectively.

$\endgroup$
1
  • $\begingroup$ The desired plot consists of the x-axis, is not defined as an array of numbers, rather as a function of b. Where, x, takes different iterations of b, from a min value of b/2 to 2b. $\endgroup$
    – Raz
    Commented Jan 4, 2018 at 13:54

3 Answers 3

3
$\begingroup$
Plot[Evaluate[Table[Callout[ConditionalExpression[2 + x b, b/2 <= x <= 2 b], b], 
 {b, 0, 1, .1}]], {x, 0, 2}]

enter image description here

Or with PlotLabels:

Plot[Evaluate[Table[ConditionalExpression[2 + x b, b/2 <= x <= 2 b], {b, .2, 1, .2}]], 
 {x, 0, 2}, PlotLabels -> Range[.2, 1, .2]]

enter image description here

$\endgroup$
1
$\begingroup$

You can plot them individually and combine by Show.

Show[Table[Plot[2 + x b, {x, b/2, 2 b}, PlotLabels -> b], {b, 1, 2, 0.1}], 
      PlotRange -> All]

enter image description here

If you want a function which would give you the plot

plot[b_] := Plot[2 + x b, {x, b/2, 2 b}, PlotLabels -> b]

plot[2.3]

enter image description here

$\endgroup$
2
  • $\begingroup$ The desired plot consists of the x-axis, is not defined as an array of numbers, rather as a function of b. Where, x, takes different iterations of b, from a min value of b/2 to 2b. $\endgroup$
    – Raz
    Commented Jan 4, 2018 at 13:55
  • $\begingroup$ Check my new answer. Is it what you are looking for? $\endgroup$
    – Sumit
    Commented Jan 4, 2018 at 16:49
0
$\begingroup$

If b is a varying parameter

Show[Table[Plot[2 + x.b, {x, b/2, 2 b}],{b,{bi,...}}]]

should solve your problem!

$\endgroup$

Your Answer

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

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