how can I include complex numbers in my calculation? I did a lot of research but couldn't find the right answer yet.
Thanks in advance!
complex numbers - npm search (npmjs.com)
Equally, there are a number of libraries for doing FFT:
fft - npm search (npmjs.com)
Most of those should work in a function node now that loading of external libraries is directly supported.
Ah. Do you have access to the settings.js file? You could load one the older way if so.
If not, is Python accessible?
Alternatively, do you have an external system you can run the calculations on? You could potentially send the data to another instance of Node-RED on a different device by creating a REST API there using an http-in/-out flow. The output of that flow would be the answer which would return to the Siemens device.
One approach is to represent complex numbers as pairs of values, either in arrays, classes, structures or some other form. Most languages don't have explicit complex number representation, so it's necessary to either write your own or use libraries which look after them for you (usually using something like the methods mentioned above).
It's been quite a while since I wrote FFT and digital filter code, but I did it in C, and used structure types for complex numbers and wrote functions to handle operations on them.
There's a lot of FFT source code available in various languages, so it might be worth taking a look to see how they implement complex types, and use something which is closest to your needs.
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.