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
 Origin Forum
 Angular coeficient

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
adeodatoarthur Posted - 06/11/2018 : 07:31:37 AM
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 !

2   L A T E S T    R E P L I E S    (Newest First)
Chris D Posted - 06/11/2018 : 3:33:56 PM
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
Hideo Fujii Posted - 06/11/2018 : 3:26:32 PM
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

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