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 data using Origin C in Code Builder

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
thebigpeeler Posted - 06/26/2013 : 09:12:32 AM
Hi guys,

So basically im writing some code using Origin C to speed up some data analysis. I have my Data in Time(X) and Amplitude in Volts (Y), using origin pro id usually go to Analysis->Signal Processing->FFT->FFT

Then id select the Amplitude column as the input, tick shift and unwrap phase,normalize the power to MSA and plot Amplitude/Phase.

Is there any way to do this in code? I've successfully managed to create new worksheets automatically and I understand how to move data from one sheet to another, but have no idea how to perform FFT like I would normally do manually, but in code. All i need is 3 columns as the output; Freq, Amplitude and Phase.

Thanks in advance guys

Oli

:D
7   L A T E S T    R E P L I E S    (Newest First)
thebigpeeler Posted - 06/28/2013 : 05:10:13 AM
thats even more awesome haha cheers man solved!

:D
Sam Fang Posted - 06/27/2013 : 11:45:02 PM
ix is a complex vector, not a string. There is a bug for SetArg function with vector.

You can also call X-Function using LabTalk in OriginC.

BOOL rc;
rc = LT_execute("fft1 ix:=col(1);");


Sam
OriginLab Technical Services
thebigpeeler Posted - 06/27/2013 : 06:56:32 AM
also, all the other arguments work fine, its only the ix input argument i cant seem to get right, is the following syntax correct?

[Book1]myData!3

:D
thebigpeeler Posted - 06/27/2013 : 06:14:11 AM
if i remove the argument completely, it works, whats going wrong?

:D
thebigpeeler Posted - 06/27/2013 : 05:41:05 AM
Cheers man, im trying to get fft1 to work but coming up with the foillowing error when i execute my code:

fft1:X-Function failed to execute!
Internal error code: -898, -45

my code is here:

void CallFFT()
{
// Load the X-Function
string strXFNameToCall = "fft1";
XFBase xf(strXFNameToCall);
if( !xf.IsValid() )
{
out_str("Failed to load xfunction.");
return;
}

// Set the arguments for the X-Function

string strFilename = "Col(1)";
if( !xf.SetArg("ix", strFilename) )
out_str("Failed to set argument filename");


// With arguments set we can now execute the X-Function
if( !xf.Evaluate() )
{
out_str("Failed to evaluate the getnlr X-Function.");
return;
}
}

:D
Sam Fang Posted - 06/27/2013 : 05:29:17 AM
fft1 is an X-Function. You can call it in Origin C. You can see following documents:
1. Calling X-Functions in Origin C
http://wikis/ocwiki/index.php?title=OCGuide%3ACalling_X-Functions_in_Origin_C

2. fft1 X-Functions
http://wikis/wiki2/index.php?title=X-Function%3AFft1


-----------------------------------------
Origin C also provides a basic function:
int fft_fft_real( int iSize, double * vSig, FFT_SIGN iSign = FFT_FORWARD )

You have to use other functions for derived results.

Sam
OriginLab Technical Services
thebigpeeler Posted - 06/26/2013 : 09:33:17 AM
or is there any way of calling fft1 with its options from the Origin c code? that would be perfect, especially if i can extract the data from the call

:D

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