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
 How could draw a tangent of a curve
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

smartgong

China
1 Posts

Posted - 04/29/2002 :  11:03:24 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
I am a new user. could anyone give me some ideas?

Jose

Netherlands
93 Posts

Posted - 04/30/2002 :  3:46:14 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
This will work with smooth data, and with points other than the first or the last of a dataset. It uses LabTalk to interactively calculate the tangent to a curve in a selected point.

1. Plot your dataset.

2. Copy the following code and paste it in the Script Window. (If the Script Window is not visible, active it by pressing ALT+3). Make sure that the Script Execution is checked (under the Edit menu in the Script Window).

3. Select all the pasted code and press ENTER to execute it. This will activate the Data Reader Tool.

4. Select one point of your dataset, or move left-right until you get it.

5. Press ENTER, and you'll have the tangent!


dotool 3; // Data Reader tool

def pointproc {

dotool -q;

%b=xof(%c); // X dataset for the current one
p1=(%C[index+1]-%C[index])/(%b[index+1]-%b[index]);
p2=(%C[index]-%C[index-1])/(%b[index]-%b[index-1]);
p=(p1+p2)/2;
c=y-p*x;
ftang(x)=$(p)*x+$(c);
layer -i200 ftang; // Plot as Line...
set ftang -c 4; // ...in blue
};


See the LabTalk help file for details about the dotool command and the PointProc macro to understand what I am doing here.

You can create a personal button to associate this script with. Consult the Origin help file, under any of these topics:

a. Script / Execution
b. Toolbar / Creating new

Jose Via, Origin WebRing member


Edited by - Jose on 04/30/2002 16:05:42
Go to Top of Page

nulmiso

Korea
3 Posts

Posted - 05/21/2002 :  8:34:06 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
You can use 'Add Function Graph' feature.

Activate a graph window and select menu

Graph -> Add Function Graph

and type in "tan(x)" next to the label 'F1(x) = '.

Click 'ok' and you can get a tangent curve.
Go to Top of Page

flirt

USA
Posts

Posted - 06/07/2005 :  10:00:21 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Both not work for me
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 06/07/2005 :  10:19:55 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Is your angular unit properly set?

Tools > Options > Numeric Format > Angular Unit

Radian | Degree | Gradian

Mike Buess
Origin WebRing Member
Go to Top of Page

flirt

USA
Posts

Posted - 06/07/2005 :  11:34:39 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:

Is your angular unit properly set?

Tools > Options > Numeric Format > Angular Unit

Radian | Degree | Gradian



Do you mean I should change any type of X into angle?
I think the original author asked how to draw a tangential line on any curve, instead of overlapping a tangent function on the graph.
For example, i have a set of magnetic resistance data, want to draw two tangentical lines to decide the critical transition point, is there a method to do this?
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 06/07/2005 :  12:04:52 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I was referring to the post above yours which used tan(x). It does make a difference which units are used with trig functions.

Mike Buess
Origin WebRing Member
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 06/09/2005 :  1:44:27 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
The File Exchange now has a simple tangent add-on for Origin 7.5...

http://www.originlab.com/fileexchange/details.aspx?fid=106

Mike Buess
Origin WebRing Member
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