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 for Programming
 LabTalk Forum
 Unused x-values in derivative w/ curve.x & sgderiv
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

JSchoeck

Germany
Posts

Posted - 01/09/2009 :  04:57:18 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi all,

I'm trying to calculate the derivative of a dataset that has varying and non-uniform x-value distances.

According to all examples I've found in the help and this forum the appropriate parameter to set the column for the x-values is "curve.x$ = wks_X;". Sadly, Origin ignores the x-values and assumes a uniform distance on the x-axis of 1.

Here's the command I'm using:

curve.x$ = wks_U;
curve.data$ = wks_I;
curve.result$ = wks_Deri;
curve.i1 = -1;
curve.smoothpts = 5;
curve.derivdeg = 1;
worksheet -t 2 4; //the 2nd column is I and originally type Y
curve.sgderiv();
worksheet -t 2 1; //converting it back to a Y-axis for plotting purposes


A problem that I have is that the derivative is only then calculated as long a the data-column is of the X-type (even though it should be of the Y-type!). That's why I declared it to be X-type initially, but of course this cannot be correct.

Can anyone point out the correct way of using a X-value column and a Y-value column together with curve.sgderiv() please?

Thanks for your time,
Johannes

Origin Ver. and SR (Select Help-->About Origin): 8 SR4
Operating System: WinXP

VincentLiu

China
Posts

Posted - 01/12/2009 :  04:02:29 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
curve.sgderiv() uses Savitzky-Golay method to differentiate the dataset. And the Savitzky-Golay method requires a constant X-spacing within the data. So that why you cannot get the right results.

Origin offers another function "Derivative" to calculate the derivative, which do not need a constant X-spacing within the data. For more details, please first select Help-> Programming-> LabTalk to open the LabTalk CHM. Then choose Search tab to search with the keywords Derivative.

Best regard,
Vincent
OriginLab Tech Services

Edited by - VincentLiu on 01/12/2009 04:04:13 AM
Go to Top of Page

JSchoeck

Germany
Posts

Posted - 01/12/2009 :  04:24:18 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks for the hint. :)
Go to Top of Page

VincentLiu

China
Posts

Posted - 01/12/2009 :  04:49:10 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by JSchoeck

Thanks for the hint. :)



You can also select Analysis-> Mathematics-> Differentiate open the Differentiate dialog to get the derivative of a dataset. For more details please refer to

http://www.originlab.com/www/helponline/Origin8/en/mathematics/differentiate.htm
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