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
 Forum for Origin C
 fft_lowpass_filtering
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

couturier

France
291 Posts

Posted - 04/02/2015 :  05:12:22 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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

Shirley_GZ

China
Posts

Posted - 04/02/2015 :  06:03:36 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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

Edited by - Shirley_GZ on 04/02/2015 06:05:41 AM
Go to Top of Page

couturier

France
291 Posts

Posted - 04/02/2015 :  07:46:36 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

Shirley_GZ

China
Posts

Posted - 04/09/2015 :  05:02:34 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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

Edited by - Shirley_GZ on 04/09/2015 05:03:13 AM
Go to Top of Page

couturier

France
291 Posts

Posted - 04/09/2015 :  09:05:55 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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.
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