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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 Angular coeficient
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

adeodatoarthur

19 Posts

Posted - 06/11/2018 :  07:31:37 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Dear Origin Crew,
I often have to calculate the angular coeficient of lines on my project. There is any faster and batter way then write 2 points of a line and calculate it by tangent manualy ? I mean an option on the OriginLab to do this ?
Thanks very much !

Hideo Fujii

USA
1582 Posts

Posted - 06/11/2018 :  3:26:32 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi adeodatoarthur,

If you meant to calculate the tangent of two points on a line directly in the graph (without going back to worksheet for calculation),
you can try the following script (modified from the 3rd sample in:
https://www.originlab.com/doc/LabTalk/ref/dotoolbox-cmd#Examples: ):
//////////////////////////////////////////////////////
type -b Pick the 1st Point by Double-Clicking or Pressing ENTER, then do the same for 2nd Point;
dotool 3;  //Data Selector
count = 1;
def pointproc {
    DS$(count)$=%C;    //Dataset Name
    IDX$(count)=index; //Row# 
    PX$(count) = X;    //X coordinate
    PY$(count) = Y;    //Y coordinate
    count++;
    if(count == 3) {
        type -a Line: %(DS1$)[$(IDX1)]:($(PX1,.2),$(PY1,.2)) - %(DS2$)[$(IDX2)]:($(PX2,.2),$(PY2,.2)); 
        type -a Slope: $((PY2-PY1)/(PX2-PX1),.3);
        dotool 0;     //Reset to Arrow tool
    }
}
//////////////////////////////////////////////////////

I hope that I didn't misunderstand what you wanted.

--Hideo Fujii
OriginLab

Edited by - Hideo Fujii on 06/11/2018 3:29:05 PM
Go to Top of Page

Chris D

428 Posts

Posted - 06/11/2018 :  3:33:56 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

Assuming you have a dataset where the X values are in column A and the Y values are in column B, you can use this LabTalk function to get the slope (angular coefficient):

double dSlope = slope(col(A), col(B));


To use it in a cell formula (a new feature in Origin 2018), the formula to put into the cell would be:

=slope(col(A), col(B))


I hope this helps.

Thanks,
Chris Drozdowski
Originlab Technical Support
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000