The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 help with script (finding x and y intercept)

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
hantuumt Posted - 02/27/2010 : 11:36:59 AM
Origin Ver. and Service Release (Select Help-->About Origin):
Operating System:

Dear members,

I have data with x (1st column) and y (2nd column) columns. I need to find the x-intercept and y-intercept. The data is in float type and 500 data points. I trying to get these points in 3 and 4th columns in the first row ....Can any one help me out please and get the

Thanks & Regards,
Hemant
9   L A T E S T    R E P L I E S    (Newest First)
SALA Posted - 08/27/2015 : 01:59:07 AM
Hi everyone, this is my first time here. I need help regarding the new intercept for x and y.
I have a curve that is going from positive to negative and I want the curve to cross x axis so e.g. now the intercept is by default at -40.1 on y axis and 3 on x axis but I want intercept to be 0 on y axis and stay 3 on x axis. Basically I just want to "move" it up and the axis to intercept at (x,y)=(3,0).
Why this is so easy in Excel and so complicated here? Or I just don't know about the function.

Thank you.

Sara Livazovic
sisel Posted - 05/03/2011 : 07:00:58 AM
Thanks for the great post. Very helpful. Sincerely, Amy
gkbradshaw Posted - 04/13/2011 : 11:56:33 PM
How would you put that output into specific cells, instead of reading the value in the command window? This would be useful when making a template...plug in the new data and the value would be listed in the two cells. Can you use a worksheet script or something like that so that anytime you change the data, those values will update?

G
hantuumt Posted - 03/02/2010 : 06:53:57 AM
Hello Larry,

yes, this is what I am exactly looking for. This code worked for me.
Thanks for the help

Regards,
Hemant
larry_lan Posted - 03/01/2010 : 05:09:20 AM
Hi:

Are you trying to find the two points marks as below image?



If so, the wiki I gave should work. Supposed you save your data in column 1 & 2 of Book1, Sheet1, you can use these scripts similar to the wiki page:

range r1 = [book1]sheet1!col(1);
range r2 = [book1]sheet1!col(2);
r2(0)=;
r1(0, r2)=;


Then you will have:

R2(0)=-0.0028986486486486
R1(0, R2)=0.67791411042945


These two values are very close to the ones you read from Data Reader.

Thanks
Larry
hantuumt Posted - 03/01/2010 : 01:50:51 AM
Hello Larry,

First of all thanks for your help and concern.

I am still facing problem as the data set is not monotonic. I tried several examples given in wiki-origin but none of them work...Is it possible to interpolate two data points close to the x-axis in order to find x-intercept and also two data points close to y-axis and find the y-intercept ?

If so can you please give me the code. The code with range (r1, r2) . does a linear fit over the entire data and hence I get intercept which I don't need. I have already posted my data in a earlier post
larry_lan Posted - 02/28/2010 : 8:48:50 PM
You can try dataset interpolation in this case.

Thanks
Larry
OriginLab Technical Services
hantuumt Posted - 02/28/2010 : 8:07:20 PM
Hi Easwar,



thank you for the reply, but I am not looking for the linear fit of data and its intercept. Perhaps my question was not clear. Let me put forward my question again with supporting data..I have origin pro 8.0 version.

Please find the data below:
column 1 column 2
-5.00E-01 -4.96E-03
-4.96E-01 -4.86E-03
-4.93E-01 -4.76E-03
-4.89E-01 -4.67E-03
-4.85E-01 -4.57E-03
-4.82E-01 -4.48E-03
-4.78E-01 -4.40E-03
-4.74E-01 -4.31E-03
-4.70E-01 -4.23E-03
-4.67E-01 -4.15E-03
-4.63E-01 -4.06E-03
-4.59E-01 -3.99E-03
-4.56E-01 -3.92E-03
-4.52E-01 -3.85E-03
-4.48E-01 -3.78E-03
-4.45E-01 -3.71E-03
-4.41E-01 -3.65E-03
-4.37E-01 -3.59E-03
-4.33E-01 -3.54E-03
-4.30E-01 -3.48E-03
-4.26E-01 -3.43E-03
-4.22E-01 -3.39E-03
-4.19E-01 -3.34E-03
-4.15E-01 -3.30E-03
-4.11E-01 -3.27E-03
-4.08E-01 -3.23E-03
-4.04E-01 -3.20E-03
-4.00E-01 -3.17E-03
-3.96E-01 -3.14E-03
-3.93E-01 -3.12E-03
-3.89E-01 -3.09E-03
-3.85E-01 -3.08E-03
-3.82E-01 -3.06E-03
-3.78E-01 -3.04E-03
-3.74E-01 -3.03E-03
-3.71E-01 -3.01E-03
-3.67E-01 -3.00E-03
-3.63E-01 -2.99E-03
-3.59E-01 -2.98E-03
-3.56E-01 -2.97E-03
-3.52E-01 -2.97E-03
-3.48E-01 -2.96E-03
-3.45E-01 -2.95E-03
-3.41E-01 -2.95E-03
-3.37E-01 -2.95E-03
-3.34E-01 -2.95E-03
-3.30E-01 -2.94E-03
-3.26E-01 -2.93E-03
-3.22E-01 -2.93E-03
-3.19E-01 -2.93E-03
-3.15E-01 -2.93E-03
-3.11E-01 -2.92E-03
-3.08E-01 -2.92E-03
-3.04E-01 -2.92E-03
-3.00E-01 -2.92E-03
-2.97E-01 -2.92E-03
-2.93E-01 -2.92E-03
-2.89E-01 -2.92E-03
-2.85E-01 -2.92E-03
-2.82E-01 -2.91E-03
-2.78E-01 -2.92E-03
-2.74E-01 -2.91E-03
-2.71E-01 -2.92E-03
-2.67E-01 -2.91E-03
-2.63E-01 -2.91E-03
-2.60E-01 -2.91E-03
-2.56E-01 -2.91E-03
-2.52E-01 -2.91E-03
-2.48E-01 -2.91E-03
-2.45E-01 -2.91E-03
-2.41E-01 -2.91E-03
-2.37E-01 -2.91E-03
-2.34E-01 -2.91E-03
-2.30E-01 -2.91E-03
-2.26E-01 -2.91E-03
-2.23E-01 -2.91E-03
-2.19E-01 -2.91E-03
-2.15E-01 -2.91E-03
-2.11E-01 -2.91E-03
-2.08E-01 -2.91E-03
-2.04E-01 -2.91E-03
-2.00E-01 -2.91E-03
-1.97E-01 -2.91E-03
-1.93E-01 -2.91E-03
-1.89E-01 -2.91E-03
-1.86E-01 -2.91E-03
-1.82E-01 -2.91E-03
-1.78E-01 -2.91E-03
-1.74E-01 -2.91E-03
-1.71E-01 -2.91E-03
-1.67E-01 -2.91E-03
-1.63E-01 -2.91E-03
-1.60E-01 -2.91E-03
-1.56E-01 -2.91E-03
-1.52E-01 -2.91E-03
-1.49E-01 -2.91E-03
-1.45E-01 -2.91E-03
-1.41E-01 -2.90E-03
-1.37E-01 -2.90E-03
-1.34E-01 -2.90E-03
-1.30E-01 -2.90E-03
-1.26E-01 -2.90E-03
-1.23E-01 -2.90E-03
-1.19E-01 -2.90E-03
-1.15E-01 -2.90E-03
-1.12E-01 -2.90E-03
-1.08E-01 -2.90E-03
-1.04E-01 -2.90E-03
-1.00E-01 -2.90E-03
-9.67E-02 -2.90E-03
-9.30E-02 -2.90E-03
-8.93E-02 -2.90E-03
-8.56E-02 -2.90E-03
-8.19E-02 -2.90E-03
-7.82E-02 -2.90E-03
-7.45E-02 -2.90E-03
-7.08E-02 -2.90E-03
-6.71E-02 -2.90E-03
-6.34E-02 -2.89E-03
-5.97E-02 -2.90E-03
-5.60E-02 -2.90E-03
-5.23E-02 -2.90E-03
-4.86E-02 -2.89E-03
-4.49E-02 -2.89E-03
-4.12E-02 -2.90E-03
-3.75E-02 -2.90E-03
-3.38E-02 -2.89E-03
-3.01E-02 -2.89E-03
-2.64E-02 -2.89E-03
-2.27E-02 -2.90E-03
-1.90E-02 -2.90E-03
-1.53E-02 -2.90E-03
-1.16E-02 -2.89E-03
-7.90E-03 -2.89E-03
-4.20E-03 -2.90E-03
-5.00E-04 -2.90E-03
3.20E-03 -2.89E-03
6.90E-03 -2.89E-03
1.06E-02 -2.90E-03
1.43E-02 -2.89E-03
1.80E-02 -2.89E-03
2.17E-02 -2.89E-03
2.54E-02 -2.90E-03
2.91E-02 -2.89E-03
3.28E-02 -2.89E-03
3.65E-02 -2.89E-03
4.02E-02 -2.89E-03
4.39E-02 -2.89E-03
4.76E-02 -2.89E-03
5.13E-02 -2.89E-03
5.50E-02 -2.89E-03
5.87E-02 -2.89E-03
6.24E-02 -2.89E-03
6.61E-02 -2.89E-03
6.98E-02 -2.89E-03
7.35E-02 -2.89E-03
7.72E-02 -2.89E-03
8.09E-02 -2.89E-03
8.46E-02 -2.89E-03
8.83E-02 -2.89E-03
9.20E-02 -2.89E-03
9.57E-02 -2.89E-03
9.94E-02 -2.89E-03
1.03E-01 -2.89E-03
1.07E-01 -2.89E-03
1.11E-01 -2.89E-03
1.14E-01 -2.89E-03
1.18E-01 -2.89E-03
1.22E-01 -2.89E-03
1.25E-01 -2.89E-03
1.29E-01 -2.89E-03
1.33E-01 -2.89E-03
1.36E-01 -2.89E-03
1.40E-01 -2.89E-03
1.44E-01 -2.89E-03
1.48E-01 -2.89E-03
1.51E-01 -2.89E-03
1.55E-01 -2.89E-03
1.59E-01 -2.89E-03
1.62E-01 -2.89E-03
1.66E-01 -2.89E-03
1.70E-01 -2.89E-03
1.73E-01 -2.89E-03
1.77E-01 -2.89E-03
1.81E-01 -2.89E-03
1.85E-01 -2.89E-03
1.88E-01 -2.89E-03
1.92E-01 -2.89E-03
1.96E-01 -2.89E-03
1.99E-01 -2.89E-03
2.03E-01 -2.88E-03
2.07E-01 -2.88E-03
2.10E-01 -2.89E-03
2.14E-01 -2.89E-03
2.18E-01 -2.89E-03
2.22E-01 -2.89E-03
2.25E-01 -2.89E-03
2.29E-01 -2.89E-03
2.33E-01 -2.88E-03
2.36E-01 -2.89E-03
2.40E-01 -2.88E-03
2.44E-01 -2.88E-03
2.47E-01 -2.88E-03
2.51E-01 -2.88E-03
2.55E-01 -2.88E-03
2.59E-01 -2.88E-03
2.62E-01 -2.88E-03
2.66E-01 -2.88E-03
2.70E-01 -2.88E-03
2.73E-01 -2.88E-03
2.77E-01 -2.88E-03
2.81E-01 -2.87E-03
2.84E-01 -2.88E-03
2.88E-01 -2.88E-03
2.92E-01 -2.88E-03
2.96E-01 -2.87E-03
2.99E-01 -2.88E-03
3.03E-01 -2.87E-03
3.07E-01 -2.87E-03
3.10E-01 -2.87E-03
3.14E-01 -2.87E-03
3.18E-01 -2.87E-03
3.21E-01 -2.87E-03
3.25E-01 -2.87E-03
3.29E-01 -2.87E-03
3.33E-01 -2.86E-03
3.36E-01 -2.86E-03
3.40E-01 -2.86E-03
3.44E-01 -2.86E-03
3.47E-01 -2.86E-03
3.51E-01 -2.86E-03
3.55E-01 -2.86E-03
3.58E-01 -2.85E-03
3.62E-01 -2.85E-03
3.66E-01 -2.85E-03
3.70E-01 -2.85E-03
3.73E-01 -2.84E-03
3.77E-01 -2.84E-03
3.81E-01 -2.84E-03
3.84E-01 -2.84E-03
3.88E-01 -2.83E-03
3.92E-01 -2.83E-03
3.95E-01 -2.83E-03
3.99E-01 -2.83E-03
4.03E-01 -2.82E-03
4.07E-01 -2.82E-03
4.10E-01 -2.82E-03
4.14E-01 -2.81E-03
4.18E-01 -2.81E-03
4.21E-01 -2.80E-03
4.25E-01 -2.80E-03
4.29E-01 -2.80E-03
4.32E-01 -2.79E-03
4.36E-01 -2.79E-03
4.40E-01 -2.78E-03
4.44E-01 -2.78E-03
4.47E-01 -2.77E-03
4.51E-01 -2.76E-03
4.55E-01 -2.76E-03
4.58E-01 -2.75E-03
4.62E-01 -2.74E-03
4.66E-01 -2.73E-03
4.69E-01 -2.72E-03
4.73E-01 -2.71E-03
4.77E-01 -2.70E-03
4.81E-01 -2.69E-03
4.84E-01 -2.67E-03
4.88E-01 -2.66E-03
4.92E-01 -2.65E-03
4.95E-01 -2.63E-03
4.99E-01 -2.61E-03
5.03E-01 -2.59E-03
5.06E-01 -2.58E-03
5.10E-01 -2.56E-03
5.14E-01 -2.53E-03
5.18E-01 -2.51E-03
5.21E-01 -2.49E-03
5.25E-01 -2.46E-03
5.29E-01 -2.43E-03
5.32E-01 -2.40E-03
5.36E-01 -2.37E-03
5.40E-01 -2.34E-03
5.43E-01 -2.31E-03
5.47E-01 -2.27E-03
5.51E-01 -2.23E-03
5.55E-01 -2.20E-03
5.58E-01 -2.15E-03
5.62E-01 -2.11E-03
5.66E-01 -2.07E-03
5.69E-01 -2.03E-03
5.73E-01 -1.98E-03
5.77E-01 -1.93E-03
5.80E-01 -1.88E-03
5.84E-01 -1.82E-03
5.88E-01 -1.77E-03
5.92E-01 -1.72E-03
5.95E-01 -1.66E-03
5.99E-01 -1.60E-03
6.03E-01 -1.54E-03
6.06E-01 -1.47E-03
6.10E-01 -1.41E-03
6.14E-01 -1.34E-03
6.17E-01 -1.27E-03
6.21E-01 -1.20E-03
6.25E-01 -1.13E-03
6.29E-01 -1.06E-03
6.32E-01 -1.01E-03
6.36E-01 -9.18E-04
6.40E-01 -8.37E-04
6.43E-01 -7.59E-04
6.47E-01 -6.79E-04
6.51E-01 -5.97E-04
6.54E-01 -5.12E-04
6.58E-01 -4.30E-04
6.62E-01 -3.46E-04
6.66E-01 -2.58E-04
6.69E-01 -1.71E-04
6.73E-01 -9.39E-05
6.77E-01 -2.98E-05
6.80E-01 6.80E-05
6.84E-01 1.51E-04
6.88E-01 2.57E-04
6.91E-01 3.54E-04
6.95E-01 4.52E-04
6.99E-01 5.49E-04
7.03E-01 6.47E-04
7.06E-01 7.45E-04
7.10E-01 8.44E-04
7.14E-01 9.45E-04
7.17E-01 1.05E-03
7.21E-01 1.12E-03
7.25E-01 1.23E-03
7.28E-01 1.34E-03
7.32E-01 1.44E-03
7.36E-01 1.55E-03
7.40E-01 1.65E-03
7.43E-01 1.76E-03
7.47E-01 1.87E-03
7.51E-01 1.97E-03
7.54E-01 2.08E-03
7.58E-01 2.19E-03
7.62E-01 2.30E-03
7.65E-01 2.41E-03
7.69E-01 2.52E-03
7.73E-01 2.63E-03
7.77E-01 2.74E-03
7.80E-01 2.85E-03
7.84E-01 2.96E-03
7.88E-01 3.07E-03
7.91E-01 3.19E-03
7.95E-01 3.30E-03
7.99E-01 3.41E-03
8.02E-01 3.52E-03
8.06E-01 3.64E-03
8.10E-01 3.75E-03
8.14E-01 3.87E-03
8.17E-01 3.98E-03
8.21E-01 4.10E-03
8.25E-01 4.21E-03
8.28E-01 4.33E-03
8.32E-01 4.45E-03
8.36E-01 4.56E-03
8.39E-01 4.68E-03
8.43E-01 4.80E-03
8.47E-01 4.91E-03
8.51E-01 5.03E-03
8.54E-01 5.15E-03
8.58E-01 5.27E-03
8.62E-01 5.39E-03
8.65E-01 5.50E-03
8.69E-01 5.62E-03
8.73E-01 5.74E-03
8.76E-01 5.86E-03
8.80E-01 5.98E-03
8.84E-01 6.10E-03
8.88E-01 6.22E-03
8.91E-01 6.34E-03
8.95E-01 6.46E-03
8.99E-01 6.58E-03
9.02E-01 6.70E-03
9.06E-01 6.83E-03
9.10E-01 6.95E-03
9.13E-01 7.07E-03
9.17E-01 7.19E-03
9.21E-01 7.31E-03
9.25E-01 7.43E-03
9.28E-01 7.56E-03
9.32E-01 7.68E-03
9.36E-01 7.80E-03
9.39E-01 7.92E-03
9.43E-01 8.04E-03
9.47E-01 8.17E-03
9.50E-01 8.29E-03
9.54E-01 8.41E-03
9.58E-01 8.53E-03
9.62E-01 8.66E-03
9.65E-01 8.78E-03
9.69E-01 8.91E-03
9.73E-01 9.03E-03
9.76E-01 9.15E-03
9.80E-01 9.28E-03
9.84E-01 9.40E-03
9.87E-01 9.52E-03
9.91E-01 9.65E-03
9.95E-01 9.77E-03
9.99E-01 9.89E-03

so the data is given above. I need to find the value in coloumn 1 when value in column 2 = 0

and value in column 2 when value in column 1 = 0
using the data reader option I got these values as -0.0029 and 0.678.

Could you please help me out. Using data reader is a tedious job as I have a lot of such data set.

Thanks & Regards,
Hemant
easwar Posted - 02/28/2010 : 11:25:31 AM
Hi Hemant,

The following code shows how to do this in Origin 8.1

Easwar
OriginLab


//assume worksheet is active
// perform linear fit with data from cols 1,2;
fitlr (1,2);
// add two result columns
range r3=3, r4=4;
r3[L]$="X Intercept";
r4[L]$="Y Intercept";
// write intercept values to resut columns
r3[1]=-1*fitlr.a/fitlr.b;
r4[1]=fitlr.a;

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000