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
 why i got different results?

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
mynameisok Posted - 03/31/2007 : 09:03:54 AM
Origin Version (Select Help-->About Origin):Origin pro 7.5 sr5
Operating System:xp


i used two methods to give on the same Dataset lowpass frequency cutoff.

one is using the menu of origin,the other is fft_lowpass(),and the Fc was the same .

but the results are different.So is bandpass.

sorry for my poor english.

i cannot figure out what happened.

here is my oc code
 


int run_fft_lowpass(double dFc)
{


Worksheet wks = Project.ActiveLayer();
if( !wks )
{
out_str("A worksheet must be active.");
return 1;
}
int iErr;
for(int i=1;i<wks.GetNumCols();i++)
{
if(wks.Columns(i).GetType()==OKDATAOBJ_DESIGNATION_Y)
{
Curve crv(wks,i);
iErr = fft_lowpass(crv, dFc);
if(iErr<0) break;
}
}
switch(iErr)
{
case -3:
out_str("Invalid cutoff frequency.");
break;
case -2:
out_str("Invalid curve.");
break;
case -1:
out_str("Curve does not meet time resolution criterion.");
default:
break;
}
return iErr;
}



7   L A T E S T    R E P L I E S    (Newest First)
Mike Buess Posted - 04/02/2007 : 09:49:27 AM
FFT Low Pass on the menu runs the [LowPass] section of Granaly.ogs. Other FFT filters are in the same file. Since there is no analytical way to determine if the LabTalk commands will pad or truncate I suggest you perform your demonstration with datasets that are already powers of 2.

Mike Buess
Origin WebRing Member
mynameisok Posted - 04/02/2007 : 09:00:12 AM
i'm just a code builder,my job is to make an auto program to deal with large number of datasets.

they want to get only one result that my final result is exactly the same as the manual operation.

maybe i should work on labtalk to find a way like what "the menu" does.

after lowpass filter,i have fft,smooth and so on,large project for me.

thank you for your advice.

Edited by - mynameisok on 04/02/2007 09:22:53 AM
Mike Buess Posted - 04/02/2007 : 08:38:23 AM
quote:
but how can i set Number of points if i wanna use fft_lowpass()?
crv.SetSize(npts) will change the number of points by truncating (if npts<current pts) or adding missing values '--' (if npts>current size). (You must change the missing values to zeros in the latter case.) However, it's not trivial to determine whether the FFT Filter menu command pads or truncates...
http://www.originlab.com/www/support/resultstech.aspx?ID=570&language=English&Version=7.5

If you just want to compare your function with the menu command I suggest you manually reduce your data size to the next lower power of two. For normal operations I see no point in restricting the number of points to a power of two in your function.

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 04/02/2007 08:43:57 AM
mynameisok Posted - 04/02/2007 : 06:47:29 AM
ah!

i finally understand what is "power of 2"

but how can i set Number of points if i wanna use fft_lowpass()?

by "vecSignal.SetSize(nPts)"?

if original signal size is smaller than nPts ,the end of signal will be filled with zero.

then i can get the same result using fft_lowpass()

is that right?


i'm reading FFTUsingNAG.c .

it's very helpful!

thanks a lot ,Mike!

Edited by - mynameisok on 04/02/2007 07:21:30 AM
Mike Buess Posted - 03/31/2007 : 11:42:20 AM
quote:
the fft_lowpass result seems unchanged,but iErr=0 ,there is no warning.
Doesn't that just mean there is nothing above the cutoff frequency that needs to be filtered out? Try lowering Fc.

Lowpass filtering from the menu sets the number of points to a power of two whereas the OC method does not. Results are the same when the point count of the original data is a power of two.

Mike Buess
Origin WebRing Member
mynameisok Posted - 03/31/2007 : 10:47:27 AM
the fft_lowpass result seems unchanged,but iErr=0 ,there is no warning.


Mike Buess Posted - 03/31/2007 : 10:08:07 AM
How do the results differ?

Mike Buess
Origin WebRing Member

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