0

I want to plot a discrete function in mathematica like, for example, the following: X=[X1,x2,X3]and Y = {1 if X<=X1,20 if X1< X<=X1+X2,40 if X1+X2< X<=X1+X2+X3}

In addition I would like to use the Manipulate code to be able how the step function moves if I change the values X1,X2 or X3.

Thanks a lot for your help!

0x32e0edfb
  • 707
  • 1
  • 6
  • 18
angelavtc
  • 41
  • 1
  • 6

1 Answers1

0
Manipulate[
  Plot[
    Piecewise[{{1,X<=X1},{20,X1<X<=X1+X2},{40,X1+X2<X<=X1+X2+X3}}],
    {X,0,100}],
  {{X1,25},0,100},{{X2,25},0,100},{{X3,25},0,100}]

Study Manipulate Docs and Piecewise Docs until you think you have this.

Bill
  • 3,664
  • 1
  • 12
  • 9