【お知らせ】この部分は英語原文のみでの提供となります。何卒ご了承ください。
2.1.22.2.1.16 fft_amp
Contents
Description
Calculate frequency and amplitude.
Syntax
void fft_amp(vector &vx, vector &vy, vector &vfreq, vector &vAmp, int nSize, bool bNormalize = false, bool bOneSide = true)
Parameters
- vx
- [input] buffer containing time
- vy
- [input] buffer containing signal
- vfreq
- [output] the result of the frequency
- vAmp
- [output] the result of the amplitude
- nSize
- [input] size of the input data
- bNormalize
- [input] normalize the out amplitude or not
- bOneSide
- [input] output one-sided amplitude or not
Return
None
Examples
Prior to compilation, load fft_utils.c to the workspace by executing the following LabTalk command:
Run.LoadOC("Originlab\fft_utils.c", 16);
To retain fft_utils.c in the workspace for successive sessions, drag and drop the file from the Temporary folder to the System folder.
EX1
//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(); } } }
Remark
See Also
Header to Include
fft_utils.h