Can someone please check my work to see if the conversion looks, correct?
Look is deception

BTW look is for me ok (not have test and I no expert) and can test self better if can compile c program.
- Compile program c
- run program c, make pipe output have file "two.txt".
- make modify main for c.
int main() {
// Example signal (sine wave + noise)
double complex signal[N];
for (int i = 0; i < N; i++) {
signal
[i
] = sin(2 * M_PI
* i
/ N
) + ((rand() % 100) / 100.0 - 0.5); // Sine wave + noise }
// Perform FFT
// fft(signal, N);
// Remove noise
// remove_noise(signal, N, THRESHOLD);
// Perform inverse FFT
// ifft(signal, N);
// Output the cleaned signal
for (int i = 0; i < N; i++) {
}
return 0;
}
- Compile modify program c
- run modify program c, make pipe output have file "one.txt".
- make modify program pascal
...
// new procedure
procedure testusefile(Filename: string; var values: TComplexArray; n: integer);
var
i: integer;
List:TStringList;
begin
List := TStringList.Create;
List.LoadFromFile(Filename);
for i := 0 to NUM - 1 do
values[i].re := List[i].ToSingle;
List.Free;
end;
Var
signal:Array[0..N-1] of Complex;//Example signal;
i:integer;
Begin
//Create a signal with random noise added.
// ++ make comment
// For i := 0 to n-1 do
// signal[i] := sin(2 * 6.28 * i / n)+((Random mod 100) / 100.0-0.5);
// ++ new procedure
testusefile('one.txt', signal, NUM);
// Perform FFT
fft(signal, N);
// Remove noise
remove_noise(signal, N, THRESHOLD);
// Perform inverse FFT
ifft(signal, N);
// Output the cleaned signal
For i := 0 to n-1 do
Writeln(cReal(Signal[i]));
End.
- Compile modify program pascal
- run modify program pascal, make pipe output have file "pascal.txt".
Then have compare output two.txt <-> pascal.txt
If want can make every calculate step and compare (4 total) and see where calculate ok or calculate wrong.
Compare value is no 100% same and can have error round very right side digit.
If not can compile c then write and I can make value for 4 step and post and you can use for test.