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
 Forum for Origin C
 fft_lowpass_filtering

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
couturier Posted - 04/02/2015 : 05:12:22 AM
Origin Ver. and Service Release (Select Help-->About Origin): 2015
Operating System:win7

I have this function for lowpass filtering:
int FFT_lowpass(vector& vX, vector& vY, vector & vecOutHPFiltering, double fcutoff)
{
vecOutHPFiltering = vY;
int n = vecOutHPFiltering.GetSize();
double dTimeStep = vX[1] - vX[0];
double dFreq = 1/dTimeStep;
double dFreqStep = 1.0/n;
double dCutoff = fcutoff/dFreq;
fft_lowpass_filtering( n, vecOutHPFiltering, dFreqStep, dCutoff);

return 0;
}

Can anybody explain why it runs well on Origin9 and above but outputs either garbage values (0, ***, ***, ***, 0, ***) or crashes Origin below 9 ?

thanks
4   L A T E S T    R E P L I E S    (Newest First)
couturier Posted - 04/09/2015 : 09:05:55 AM
Thanks for the workaround.

For anyone interested by the workaround, first line (//vecOutHPFiltering = vY;) should be uncommented, or the function will not work if output column doesn't already exist.
Shirley_GZ Posted - 04/09/2015 : 05:02:34 AM
Hi Couturier,

This is a bug (ORG-5455) which have been fixed since 9.0. You can use the below workaround:

int FFT_lowpass(vector& vX, vector& vY, vector & vecOutHPFiltering, double fcutoff)
{
//vecOutHPFiltering = vY;
int n = vecOutHPFiltering.GetSize();
double dTimeStep = vX[1] - vX[0];
double dFreq = 1/dTimeStep;
double dFreqStep = 1.0/n;
double dCutoff = fcutoff/dFreq;
vector v1;
v1 = vY;
//fft_lowpass_filtering( n, vecOutHPFiltering, dFreqStep, dCutoff);
fft_lowpass_filtering( n, v1, dFreqStep, dCutoff);
vecOutHPFiltering = v1;
return 0;
}

Thanks,
Shirley

Originlab Technical Service Team
couturier Posted - 04/02/2015 : 07:46:36 AM
Here are some simple steps:
- New a book, fill col(A) with row numbers and col(B) with normal random numbers.
- In script window, type the following:
range r1=1, r2=2, r3=3;
FFT_lowpass(r1, r2, r3, 0.1);

I get the following result in col(C):
***
0.00%
***
-1.0033E290
***
***
-USD 8 686 330 409 166 935 800 000 000 000.00
***
1.91794E-22
***
***
***
***
2.48448E-109
***
P€Hc^oß{¼-Øx§ô{°8Naø{
1.2401335157637E-35
***
1.8E+200%
***
***
-1.3698364388462E-199
***
***
***
JPY 0.559
-0.86485
-1.22789
-2.14137
0.17896
-0.99818
-0.4235

If I run the function a 2nd time, Origin crashes
Shirley_GZ Posted - 04/02/2015 : 06:03:36 AM
Hi Couturier,

We have tested your script in both Origin 8.5.1 and 8.6. It works well (Origin doesn’t crash).

Would you tell us your detailed steps about how to call this function? If possible would you please send us the sample data via tech@originlab.com?

Thanks,

Originlab Technical Service Team

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