|
SEQUENCEName:
Specifically, you specify a start value, an increment, and a stop value. You can also optionally specify a repeat factor (this defaults to 1 if not specified). The 2010/11 version of Dataplot updated this command to support variable arguments for the start, increment, stop, and repeat factors. If more than one of these is a variable (as oppossed to a constant/parameter), then these variable must have the same length. If a variable is used for one or more of the arguments, then we essentially create k separate sequences (where k is the number of elements in the variable) and append the results together. Arguments that are entered as constants or parameters will use the same value for each sequence. In addition, a new syntax was added where the first argument is a list of values and the second argument is the number of times that each value is repeated. This syntax is useful when you want to generate a simple sequence with repeat values where the number of repeats is variable. See the Note section below for some examples of using this new syntax.
where <start> is a constant, parameter, or variable that specifies the beginning value for the sequence; <inc> is a constant, parameter, or variable that specifies the increment value of the sequence; <stop> is a constant, parameter, or variable that specifies the ending value of the sequence; and <resp> is a variable where the generated sequence is saved. This is the most common syntax for this command.
FOR I = <start2> <inc2> <stop2> where <start> is a constant, parameter, or variable that specifies the beginning value for the sequence; <inc> is a constant, parameter, or variable that specifies the increment value of the sequence; <stop> is a constant, parameter, or variable that specifies the ending value of the sequence; <start2> is a number or parameter that identifies the first row of <resp> in which the sequence is saved (typically it has a value of 1); <inc2> is a number or parameter that identifies the row increment of <resp> in which the sequence is saved (typically it has a value of 1); <stop2> is a number or parameter that identifies the last row of <resp> in which the sequence is saved; and <resp> is a variable where the generated sequence is saved.
This syntax is similar to syntax 1 except that the generated
sequence is repeated until the rows of
where <start> is a constant, parameter, or variable that specifies the beginning value for the sequence; <repeat> is a constant, parameter, or variable that specifies the number of times each value in the sequence is repeated; <inc> is a constant, parameter, or variable that specifies the increment value of the sequence; <stop> is a constant, parameter, or variable that specifies the ending value of the sequence; and <resp> is a variable where the generated sequence is saved. This syntax is useful for generating sequence like 1 1 1 2 2 2 3 3 3 4 4 4.
FOR I = <start2> <inc2> <stop2> where <start> is a constant, parameter, or variable that specifies the beginning value for the sequence; <repeat> is a constant, parameter, or variable that specifies the number of times each value in the sequence is repeated; <inc> is a constant, parameter, or variable that specifies the increment value of the sequence; <stop> is a constant, parameter, or variable that specifies the ending value of the sequence; <start2> is a number or parameter that identifies the first row of <resp> in which the sequence is saved (typically it has a value of 1); <inc2> is a number or parameter that identifies the row increment of <resp> in which the sequence is saved (typically it has a value of 1); <stop2> is a number or parameter that identifies the last row of <resp> in which the sequence is saved; and <resp> is a variable where the generated sequence is saved.
This syntax is similar to syntax 3 except that the generated
sequence is repeated until the rows of
where <values> is a constant, parameter, or variable that specifies the values for the sequence; <repeat> is a constant, parameter, or variable that specifies the number of times each value in <values> is repeated; and <resp> is a variable where the generated sequence is saved. This syntax is useful when the number of repeated values varies. For example, you can do something like
LET REP = DATA 3 3 2 4 4
LET X = SEQUENCE 1 1 10 FOR I = 1 1 100 LET X = SEQUENCE -4 9 1 4 LET X = SEQUENCE 1 50 1 2 FOR I = 1 1 100
you can enter the commands
LET STOP = DATA 5 33 67 LET Y = SEQUENCE START 1 STOP To generate the sequence
you can enter the command
LET REP = DATA 3 2 4 5 LET Y = SEQUENCE VAL REP Additional examples of using the variables with the SEQUENCE command are given in the Program section below.
2010/11: Added support for variables as arguments 2010/11: Added support for Syntax 5 LET X = SEQUENCE -4 1 4 FOR I = 1 1 81 LET Y = SEQUENCE -4 9 1 4 LET Z = X**2+Y**2-X*Y LET Z0 = SEQUENCE 5 5 40 CONTOUR PLOT Z X Y Z0Program 2: set write decimals 1 . . Step 1: First test basic current usage . let y = sequence 1 1 10 print y --------------- Y --------------- 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 pause delete y . let y = sequence 1 3 1 10 print y --------------- Y --------------- 1.0 1.0 1.0 2.0 2.0 2.0 3.0 3.0 3.0 4.0 4.0 4.0 5.0 5.0 5.0 6.0 6.0 6.0 7.0 7.0 7.0 8.0 8.0 8.0 9.0 9.0 9.0 10.0 10.0 10.0 pause delete y . . Step 2: Now test "variable" syntax . let rep = data 1 2 3 1 2 3 1 2 3 1 let y = sequence 1 rep 1 10 print y --------------- Y --------------- 1.0 2.0 3.0 4.0 5.0 6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 3.0 4.0 4.0 5.0 5.0 6.0 6.0 7.0 7.0 1.0 1.0 2.0 2.0 3.0 3.0 4.0 4.0 5.0 5.0 6.0 6.0 1.0 1.0 2.0 2.0 3.0 3.0 4.0 4.0 5.0 5.0 1.0 1.0 2.0 2.0 3.0 3.0 4.0 4.0 1.0 1.0 2.0 2.0 3.0 3.0 1.0 1.0 2.0 2.0 1.0 1.0 pause delete y stop . let start = data 1 100 1000 let inc = data 1 10 100 let stop = data 10 1000 10000 let rep = data 3 2 1 let y = sequence start rep inc stop print y --------------- Y --------------- 1.0 1.0 1.0 2.0 2.0 2.0 3.0 3.0 3.0 4.0 4.0 4.0 5.0 5.0 5.0 6.0 6.0 6.0 7.0 7.0 7.0 8.0 8.0 8.0 9.0 9.0 9.0 10.0 10.0 10.0 100.0 100.0 110.0 110.0 120.0 120.0 130.0 130.0 140.0 140.0 150.0 150.0 160.0 160.0 170.0 170.0 180.0 180.0 190.0 190.0 200.0 200.0 210.0 210.0 220.0 220.0 230.0 230.0 240.0 240.0 250.0 250.0 260.0 260.0 270.0 270.0 280.0 280.0 290.0 290.0 300.0 300.0 310.0 310.0 320.0 320.0 330.0 330.0 340.0 340.0 350.0 350.0 360.0 360.0 370.0 370.0 380.0 380.0 390.0 390.0 400.0 400.0 410.0 410.0 420.0 420.0 430.0 430.0 440.0 440.0 450.0 450.0 460.0 460.0 470.0 470.0 480.0 480.0 490.0 490.0 500.0 500.0 510.0 510.0 520.0 520.0 530.0 530.0 540.0 540.0 550.0 550.0 560.0 560.0 570.0 570.0 580.0 580.0 590.0 590.0 600.0 600.0 610.0 610.0 620.0 620.0 630.0 630.0 640.0 640.0 650.0 650.0 660.0 660.0 670.0 670.0 680.0 680.0 690.0 690.0 700.0 700.0 710.0 710.0 720.0 720.0 730.0 730.0 740.0 740.0 750.0 750.0 760.0 760.0 770.0 770.0 780.0 780.0 790.0 790.0 800.0 800.0 810.0 810.0 820.0 820.0 830.0 830.0 840.0 840.0 850.0 850.0 860.0 860.0 870.0 870.0 880.0 880.0 890.0 890.0 900.0 900.0 910.0 910.0 920.0 920.0 930.0 930.0 940.0 940.0 950.0 950.0 960.0 960.0 970.0 970.0 980.0 980.0 990.0 990.0 1000.0 1000.0 1000.0 1100.0 1200.0 1300.0 1400.0 1500.0 1600.0 1700.0 1800.0 1900.0 2000.0 2100.0 2200.0 2300.0 2400.0 2500.0 2600.0 2700.0 2800.0 2900.0 3000.0 3100.0 3200.0 3300.0 3400.0 3500.0 3600.0 3700.0 3800.0 3900.0 4000.0 4100.0 4200.0 4300.0 4400.0 4500.0 4600.0 4700.0 4800.0 4900.0 5000.0 5100.0 5200.0 5300.0 5400.0 5500.0 5600.0 5700.0 5800.0 5900.0 6000.0 6100.0 6200.0 6300.0 6400.0 6500.0 6600.0 6700.0 6800.0 6900.0 7000.0 7100.0 7200.0 7300.0 7400.0 7500.0 7600.0 7700.0 7800.0 7900.0 8000.0 8100.0 8200.0 8300.0 8400.0 8500.0 8600.0 8700.0 8800.0 8900.0 9000.0 9100.0 9200.0 9300.0 9400.0 9500.0 9600.0 9700.0 9800.0 9900.0 10000.0 pause delete y start rep inc stop . let start = data 1 2 3 4 5 let rep = data 5 3 1 4 2 let y = sequence start rep print y --------------- Y --------------- 1.0 1.0 1.0 1.0 1.0 2.0 2.0 2.0 3.0 4.0 4.0 4.0 4.0 5.0 5.0 pause delete y start rep
Date created: 11/30/2010 |