Hi umira,
How about the following snippet? Having the curve's XY in the first two columns, and X position of
your desired contact, it uses the differentiate x-function on the main curve, interp1 x-function to
interpolate the main and derivative curves. You can modify as you need, such as for smoothing options, etc.
/////////////////////////////////////////////////
mybook$=%H; //Workbook name
differentiate -r 2 iy:=[mybook$]1!(A,B); //Get derivatives
interp1 -r 2 ix:=[mybook$]1!C iy:=[mybook$]1!(A,B); //interp original data
interp1 -r 2 ix:=[mybook$]1!C iy:=[mybook$]1!(A,D); //interp derivative data
myx=col(3)[1]; //Contact x
myy=col(5)[1]; //Contact y
myslope=col(6)[1];
myxintercept=myx-myy/myslope;
myyintercept=myy-myx*myslope;
worksheet -a 2; //add col(7) and col(8) for tangent line
range slopex=col(7);
range slopey=col(8);
wks.col7.type=4; //set col(7) as X
plotxy [mybook$]1!col(2) plot:=200; //Line plot col(2)
//y1=0; if you want to have a predetermined bottom
//x2=10; if you want to have a predetermined right-end
slopex[1]=(y1-myyintercept)/myslope; //x of frame bottom
slopey[1]=y1; //y of frame bottom
slopex[2]=myx;
slopey[2]=myy;
slopex[3]=x2; //x of right end of graph frame
slopey[3]=slopex[3]*myslope+myyintercept; //y at right end
range sline=[mybook$]1!col(8);
layer -i202 sline; //add Line+Symbol slope plot
slopey[C]$= slope: $(myslope)
Y intercept: $(myyintercept)
X intercept: $(myxintercept)
Bottom X: $(slopex[1])
Bottom Y: $(slopey[1]); //Comment on parameters
/////////////////////////////////////////////////
Hope this helps.
--Hideo Fujii
OriginLab