2.2.9 cxt

Brief Information

Shift curve in X direction

Command Line Usage

1. cxt 1 10; // shift the plot 1 to right by 10

2. cxt 1 -10 // sift the plot 1 to the left by 10

3. cxt 1 10 4; // shift the peak of the curve to x=10

X-Function Execution Options

Please refer to the page for additional option switches when accessing the x-function from script

Variables

Display
Name
Variable
Name
I/O
and
Type
Default
Value
Description
Curve to Translate iy

Input/Output

XYRange

<active>
Curve to Translate
Shift Value depending on Mode val

Input

double

0
Specify the shift value
X Data Shifting Mode mode

Input

int

val
Mode to shift X

Option list:

  • 0 or val: Specified Amount -- Shift X by val directly
  • 1 or beg: First Point to -- Shift begin point to val
  • 2 or end: Last Point to -- Shift end point to val
  • 3 or low: Minimum To -- Shift valley position to val
  • 4 or high: Maximum To -- Shift peak position to val
Actual X Shift Amount odx

Output

double

<optional>
Output actual X shift amount

Description

Shift curve in X direction according to the different modes

Examples

// The cxt function can be used to shift the x values of a plotted dataset
// New book and import data
newbook;
path$ = system.path.program$ + "Samples\Signal Processing\TR4MM.DAT";
impasc fname:=path$;
// Setup data so each has its own X data
page.xlcolname = 0; // Turn off "Spreadsheet Cell Notation" (SCN) 
wks.col1.type = 1;
wks.col = 1;
wks.insert(Time1);
wks.col = 3;
wks.insert(Time2);
col(1) = data(.01,38,.01);
col(3) = data(.01,38,.01);
// These are the ranges for plotting columns 2 vs 1 and 4 vs 3
range r1 = (1,2);
range r2 = (3,4);
win -t plot line;
plotxy r1 plot:=200 ogl:=1;
plotxy r2 plot:=200 ogl:=1;
set %c -c 2; //set active plot (usually plot 1) color as red
win -z; //Maximize window
// Pause so we can see the shift between our two curves 
type -b Our two plots appear to be offset in the X direction. We can use the cxt command to shift one curve.;

// Now remove the offset by shifting
cxt iy:=r1 val:=-.58;

For the Spreadsheet Cell Notation in the workbook, please see FAQ-849 for more information.


Keywords:correction, translate, translation