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

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
Stefan.E.S Posted - 02/18/2010 : 06:41:12 AM
Origin Ver.8.1 and Service Release 1(Select Help-->About Origin):
Operating System: WinXP

I am trying to perfom a fft_lowpass filtering of using Origin C using the following lines of code


	Dataset TOF(wksData,wksData.Columns("TOF").GetIndex());
	Dataset PHonIon(wksData,wksData.Columns("PHonIon").GetIndex());
	Dataset PHoffIon(wksData,wksData.Columns("PHoffIon").GetIndex());
	Dataset PHonIoff(wksData,wksData.Columns("PHonIoff").GetIndex());
	Dataset Signal(wksData,wksData.Columns("Signal").GetIndex());
	Dataset FFTtof(wksData,wksData.Columns("FFTtof").GetIndex());
	Dataset FFTsig(wksData,wksData.Columns("FFTsig").GetIndex());
	
	int npts = PHonIon.GetSize();
	Signal.SetSize(npts);

	int nptsFFT = 1;
	while (nptsFFT<npts) nptsFFT*=2; // FFT requires the number of points being equal a power of 2
	vector FFTx, FFTy;
    FFTtof.SetSize(nptsFFT);
    FFTsig.SetSize(nptsFFT);
    
	for (int n=0; n<npts; n++)
	{
		Signal[n] = -PHonIon[n]+PHoffIon[n]+PHonIoff[n]; // these are the data to be filtered
		FFTtof[n] = TOF[n];
		FFTsig[n] = Signal[n];
	}
	double dt = TOF[1]-TOF[0];
	for (n=npts;n<nptsFFT;n++)
	{
		FFTtof[n] = FFTtof[n-1]+dt;
		FFTsig[n] = 0.0;
	}

	Curve FFTcurve(FFTtof,FFTsig);
    int ierr = fft_lowpass(FFTcurve,2e7);
    if (ierr>0)
    {
    	string messagestr;
    	messagestr.Format("ERROR: FFT returned error code %d",ierr);
    	MessageBox(NULL,messagestr);
    }    
    FFTtof.SetSize(npts);
    FFTsig.SetSize(npts);



It appears that the data in the worksheet columns "FFTtof" and "FFTsig" are not changed by fft_lowpass. What am I doing wrong?
1   L A T E S T    R E P L I E S    (Newest First)
Penn Posted - 03/09/2010 : 02:29:01 AM
Hi,

There are two prototypes for fft_lowpass function.

int fft_lowpass(Curve& crvSignal, double dFc);
int fft_lowpass(vector& vecSignal, double dFc, vector* vecTime=NULL);

In your code, you are using the first one. However, we have tried this one and found a bug. We will fix this bug in the future version. For now, you can use the second one.

Penn
OriginLab Technical Services

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