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
 defining my own window functions to use with FFT
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

a_user

USA
0 Posts

Posted - 08/14/1998 :  7:12:00 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Is there any way that I can define my own window function to be used with the
FFT? I've got data and there are bits of it that aren't being resolved when I
use any of the built-in functions (you can vaguely see a small bump in the side
of another peak if you use your imagination.)

This is kind of urgent also.

Ideas?

Cheers

Tim

tpozar

Slovenia
Posts

Posted - 09/06/2005 :  07:24:11 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I would like to include my own window function as well. How can I do this? I need a window funcion that is similar to Rectangle Window but it should not have so sharp edges.
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 09/06/2005 :  11:04:10 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
You could try the trapezoid window defined by the break points tb1, tb2, tb3 and tb4...

f(i)=0 for i<tb1
f(i) rises linearly to 1 for tb1<=i<tb2
f(i)=1 for tb2<=i<tb3
f(i) falls linearly to 0 for tb3<=i<tb4
f(i)=0 for tb4<=i

The script below implements the function in LabTalk. Depending on your Origin version you can assign the script to a toolbar button. In all versions you can assign it to the Custom Routine button as explained here..

http://www.originlab.com/www/support/resultstech.aspx?ID=655&language=English

Apply the script to your worksheet data before you FFT by selecting the data column and clicking the appropriate button. If your data are complex you must apply it to the real and imaginary columns separately.

# Labtalk script starts here
get %C -er npt; // how many points in column?
// initialize break points
if(tb1==0/0) tb1=1;
if(tb2==0/0) tb2=2;
if(tb3==0/0) tb3=3;
if(tb4==0/0) tb4=4;
# ask user
getn (tb1) tb1
(tb2) tb2
(tb3) tb3
(tb4) tb4
(Enter break points (1-$(npt)));
tmp=data(1,npt); // create temporary dataset
tmp=0; // initialize to zero
for(i=tb1;i<tb2;i++) {tmp[i]=(i-tb1)/(tb2-tb1)};
for(i=tb2;i<tb3;i++) {tmp[i]=1};
for(i=tb3;i<tb4;i++) {tmp[i]=1 - (i-tb3)/(tb4-tb3)};
(%C)*=tmp; // multiply column by trapezoid window
del tmp; // delete temporary dataset

...You can also run it from the script window. Select all lines of script, copy with Ctrl+C, paste (Ctrl+V) to script window, select all lines in script window and press Enter.

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 09/06/2005 11:08:27 AM
Go to Top of Page

tpozar

Slovenia
Posts

Posted - 09/06/2005 :  1:15:30 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
This will probably help. Now I have to go through your manual to make it work.

I have OriginPro 7.5 SR0 v7.5714 (B714).

Thanks for your help.
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