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
 Pkfind X-function

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
sperling Posted - 05/10/2018 : 11:26:00 AM
I've found that when using the pkfind X-function, the peak locations aren't interpolated between values of x. This is even the case using the first derivative and smoothing. This leads to data that's discretized along the x-axis spacing.

Am I doing something wrong? Is there an alternate method?
3   L A T E S T    R E P L I E S    (Newest First)
yuki_wu Posted - 05/15/2018 : 02:09:57 AM
Hi,

So far, the basic idea of the First Derivative Method is as follow:
https://www.originlab.com/doc/X-Function/ref/pkFind

1) A positive peak center locates in a position x_c, where the first derivative at x_c-1 is positive while the first derivative at x_c+1 is negative;
2) A negative peak center locates in a position x_c, where the first derivative at -1 is negative while the first derivative at +1 is positive.

After performing differentiation, we could see that:

Based on the method above, so we pick the point index = 44.

For now, it seems that we don’t have a good method to pick all the zero-crossing value as you desired by pkFind X-Function, but levelcrossing X-Function could help after you perform differentiation:
https://www.originlab.com/doc/X-Function/ref/levelcrossing

Hope it helps.

Regards,
Yuki
OriginLab
sperling Posted - 05/14/2018 : 1:08:16 PM
Thanks for replying, Yuki.

quote:
Originally posted by yuki_wu
Could you show me your data? It will help me to understand your question fully.



I'll demonstrate:

1) Fill the first column with 1 to 100. Set the second as Gauss(Col(1),0,43.5,15,1)

2) Use
pkFind iy:=col(2) smooth:=5 method:=first ocenter:=Col(3) ocenter_x:=Col(4)


The reported center index is 44 as is the center in this case.

The problem is that the Savitzky-Golay method is supposed to interpolate to get the zero-crossings. If instead of the above X-function, I use

differentiate iy:=Col(2) order:=1 smooth:=1 poly:=2 npts:=5 oy:=Col(3);
dataset xset=Col(1)[30:60], dyset=Col(3)[30:60];
xset(0,dyset)=


Then I get 43.5, which is what's specified. The problem is that I had to artificially limit the dataset to avoid the ends. Also, if there were more than one peak, this code wouldn't return all the zero-crossings (peak locations).

I was hoping pkFind would include some kind of algorithm to address these issues. However, the pkFind function seems to operate in a non-standard manner. Is there some easy way to make Origin interpolate the peak locations?
yuki_wu Posted - 05/10/2018 : 11:51:14 PM
Hi,

Peak in theory is the data point that has the maximum y value, so it should be the existing point of the data. An existing point must have its y value and the corresponding x value, so I am not sure why you need interpolation.

Could you show me your data? It will help me to understand your question fully.

Regards,
Yuki
OriginLab

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