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
 Problem with the fft_amp function

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
huah2002 Posted - 09/17/2022 : 08:10:40 AM
Hi,

I want to use the fft_amp function to analyze an oscillating signal. I am using Origin 2022 (64-bit) SR1.

I have tested the example in https://www.originlab.com/doc/en/OriginC/ref/fft_amp . I have compiled the code after typing 'Run.LoadOC("Originlab\fft_utils.c", 16)' in the command window. However, the Ampilitude column remains blank after I execute the fft_amp_ex2() function.

I would like to ask for some advice.

Thank you.

Here is the code from https://www.originlab.com/doc/en/OriginC/ref/fft_amp.


//Before running this example, import \\Samples\Signal Processing\fftfilter1.DAT to worksheet
#include <fft_utils.h>
void fft_amp_ex2()
{
Worksheet wks = Project.ActiveLayer();
if( wks )
{
Column colX(wks, 0);
Column colY(wks, 1);
if( colX && colY )
{

XYRange rng;
rng.Add(wks, 0, "X");
rng.Add(wks, 1, "Y");

vector vX, vY;
rng.GetData(vY, vX);
int nSize = vX.GetSize();

// prepare frequcy and amilitide columns
Column colFreq(wks, wks.AddCol());
colFreq.SetLongName("Frequency");

Column colAmp(wks, wks.AddCol());
colAmp.SetLongName("Ampilitude");

vector& vFreq = colFreq.GetDataObject();
vector& vAmp = colAmp.GetDataObject();

// to calculate frequcy and ampilitude
fft_amp(vX, vY, vFreq, vAmp, nSize);

// plot
GraphPage gp;
gp.Create("origin");

GraphLayer gl = gp.Layers(0);
Curve cv(wks, colFreq.GetIndex(), colAmp.GetIndex());
gl.AddPlot(cv);
gl.Rescale();
}
}
}


1   L A T E S T    R E P L I E S    (Newest First)
minimax Posted - 10/09/2022 : 03:40:44 AM
Hi huah2002,

It is indeed a bug and we will get it fixed in the upcoming version, Origin 2023. (internal issue record is ORG-25788)

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