Changeset 435 for trunk/examples
- Timestamp:
- May 9, 2006, 5:56:32 PM (19 years ago)
- Location:
- trunk/examples/zoo/sequence
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/examples/zoo/sequence/sequence2.tcl
r433 r435 16 16 17 17 set func [$driver get input.string(func).current] 18 set pvals [$driver get input.string(pvals).current] 18 set avals [$driver get input.string(avals).current] 19 set bvals [$driver get input.string(bvals).current] 19 20 20 # remove any commas in the pvals list 21 regsub -all {,} $pvals {} pvals 21 # remove any commas in the avals/bvals lists 22 regsub -all {,} $avals {} avals 23 regsub -all {,} $bvals {} bvals 22 24 23 25 # change "x" to $x in expression 24 26 regsub -all {x} $func {$x} func 25 regsub -all {P} $func {$P} func 27 regsub -all {A} $func {$A} func 28 regsub -all {B} $func {$B} func 26 29 27 30 set xmin -1 28 31 set xmax 1 29 32 set npts 30 30 foreach P $pvals { 31 $driver put output.sequence(outs).element($P).index $P 32 $driver put output.sequence(outs).element($P).curve.xaxis.label "x" 33 $driver put output.sequence(outs).element($P).curve.yaxis.label \ 34 "Function y(x)" 33 foreach A $avals { 34 set elem output.sequence(outs).element($A) 35 $driver put $elem.index $A 35 36 36 for {set i 0} {$i < $npts} {incr i} { 37 set x [expr {$i*($xmax-$xmin)/double($npts) + $xmin}] 38 set y [expr $func] 39 $driver put -append yes \ 40 output.sequence(outs).element($P).curve.component.xy "$x $y\n" 37 if {[llength $bvals] > 0} { 38 # one or more B values -- put out a separate curve for each B value 39 foreach B $bvals { 40 $driver put $elem.curve($B).about.label "B = $B" 41 $driver put $elem.curve($B).about.group "A = $A" 42 $driver put $elem.curve($B).xaxis.label "x" 43 $driver put $elem.curve($B).yaxis.label "Function y(x)" 44 45 for {set i 0} {$i < $npts} {incr i} { 46 set x [expr {$i*($xmax-$xmin)/double($npts) + $xmin}] 47 set y [expr $func] 48 $driver put -append yes \ 49 $elem.curve($B).component.xy "$x $y\n" 50 } 51 } 52 } else { 53 # no B values -- put out a single curve for each element 54 $driver put $elem.curve.xaxis.label "x" 55 $driver put $elem.curve.yaxis.label "Function y(x)" 56 57 for {set i 0} {$i < $npts} {incr i} { 58 set x [expr {$i*($xmax-$xmin)/double($npts) + $xmin}] 59 set y [expr $func] 60 $driver put -append yes \ 61 output.sequence(outs).element($A).curve.component.xy "$x $y\n" 62 } 41 63 } 42 64 } -
trunk/examples/zoo/sequence/tool2.xml
r433 r435 17 17 <about> 18 18 <label>Function</label> 19 <description>Function to plot y=f(x), where x is the range, and P is some other parameter, set below.</description>19 <description>Function to plot y=f(x), where x is the range, and A and B are some other parameters, set below.</description> 20 20 </about> 21 <default> P*x + 2</default>21 <default>A*x + 2</default> 22 22 </string> 23 <string id=" pvals">23 <string id="avals"> 24 24 <about> 25 <label>P values</label> 26 <description>List of values for parameter P in the function above.</description> 25 <label>A values</label> 26 <description>List of values for parameter A in the function above.</description> 27 <diffs>ignore</diffs> 27 28 </about> 28 29 <default>0, 1, 2</default> 30 </string> 31 <string id="bvals"> 32 <about> 33 <label>B values</label> 34 <description>List of values for parameter B in the function above.</description> 35 <diffs>ignore</diffs> 36 </about> 37 <default></default> 29 38 </string> 30 39 </input> … … 32 41 <sequence id="outs"> 33 42 <about><label>Sequence of Plots</label></about> 34 <index><label>Parameter P</label></index>43 <index><label>Parameter A</label></index> 35 44 </sequence> 36 45 </output>
Note: See TracChangeset
for help on using the changeset viewer.