我在android中做离散快速傅立叶,基于样本数组,唯一的问题是在某些部分没有传递值继承我的代码
tam = ed_vector.getText().toString();
mues = ed_muestra.getText().toString();
double sumreal, sumima;
String [] reales;
String [] imaginarios;
String[] items = mues.replaceAll("\\s", "").split(",");
reales=new String[items.length];
imaginarios=new String[items.length];
vec = new int[items.length];
N = items.length;
for (int i = 0; i < N; i++) {
vec[i] = Integer.parseInt(items[i]);
}
for (int k = 0; k < N; k++) {
sumreal=0;
sumima=0;
for (int n = 0; n < N; n++) {
sumreal += vec[n] * Math.cos(2 * Math.PI * n * k / N);
sumima += -vec[n] * Math.sin(2 * Math.PI * n * k / N);
}
real = Double.toString(sumreal);
- 我觉得遗嘱值得失去----
ima = Double.toString(sumima);
reales[k] = real;
imaginarios[k] = ima;
}
tv_ans.setText(Arrays.toString(reales));
tv_ans2.setText(Arrays.toString(imaginarios));
我在Netbeans上做了它并且它工作我不知道为什么在android中传递它不起作用