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
 Problem with the fft_amp function
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

huah2002

1 Posts

Posted - 09/17/2022 :  08:10:40 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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();
}
}
}



Edited by - huah2002 on 09/17/2022 08:35:48 AM

minimax

351 Posts

Posted - 10/09/2022 :  03:40:44 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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)
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