0
對於這個問題,我使用的數學庫從Apacheorg.apache.commons.math3.transform當輸入是複雜的[],然後雙擊[]
我的目標FastFourierTransformer返回不同的價值是讓我輸入在對輸入值的正向傅立葉變換的結果執行逆傅里葉變換之後進行迴歸。
當我對輸入的正向傅立葉變換的結果執行逆傅里葉變換時,我得到正確的輸出。
我可能做錯了什麼?
public void fourierTestTemp(){
double[] input = new double[]{1,0,0,0,0,0,0,66,888,0,0,0,0,0,0,0};//Length = 16
double[] result = new double[input.length];//This double array will hold the results of the fourier transform
FastFourierTransformer transformer = new FastFourierTransformer(DftNormalization.UNITARY);//The FastFourierTransformer class by Apache
Complex[] complx = transformer.transform(result, TransformType.FORWARD);//Apply fourier transform to double[]
//Go through Complex value results and obtain absolute value
for (int i = 0; i < complx.length; i++) {
result[i] = complx[i].abs();
}
//Perform inverse transform on the obtained absolute values from the forward transform.
complx = transformer.transform(result, TransformType.INVERSE);
//Go through Complex value results and obtain absolute value
for (int i = 0; i < complx.length; i++) {
result[i] = complx[i].abs();
}
//Print results
for (int i = 0; i < result.length; i++) {
System.out.print(result[i]+",");
}
}
謝謝你的回答。你如何認爲我可以將[1,2,3]這樣的矢量轉換成你正在談論的形式? – AliAvci
[1,2,3,2]在1周圍是圓對稱的。 – hotpaw2