how do I implement a real time FFT in simulink?
I need to implement a real time FFT of the signal in the attached simulink model in order to detect the frequency and phase of the highest peak (it’s a single sinusoid, so it shouldn’t be an issue). As you can see, I’ve set the simulation step to 1/48000. I would like the detection update rate to be 40Hz, so the FFT is run 40 times a second. I’d like the FFT to be run on the newest samples (i.e. 48000/40) plus an overlap of 50% of the previous set (48000/80), so in other words, the latest 1800 samples. I’d like to zero pad this up to the next power of 2.
I was trying to figure out how to do a FIFO buffer that saves the last 1800 samples, but I couldn’t figure that out, and I couldn’t advance past that stage.
In case it helps, here’s what I have:
Simulink Version 24.2 (R2024b)
Control System Toolbox Version 24.2 (R2024b)
DSP System Toolbox Version 24.2 (R2024b)
Optimization Toolbox Version 24.2 (R2024b)
Signal Processing Toolbox Version 24.2 (R2024b)
Stateflow Version 24.2 (R2024b)
Statistics and Machine Learning Toolbox Version 24.2 (R2024b)
Thanks in advance
-BastianI need to implement a real time FFT of the signal in the attached simulink model in order to detect the frequency and phase of the highest peak (it’s a single sinusoid, so it shouldn’t be an issue). As you can see, I’ve set the simulation step to 1/48000. I would like the detection update rate to be 40Hz, so the FFT is run 40 times a second. I’d like the FFT to be run on the newest samples (i.e. 48000/40) plus an overlap of 50% of the previous set (48000/80), so in other words, the latest 1800 samples. I’d like to zero pad this up to the next power of 2.
I was trying to figure out how to do a FIFO buffer that saves the last 1800 samples, but I couldn’t figure that out, and I couldn’t advance past that stage.
In case it helps, here’s what I have:
Simulink Version 24.2 (R2024b)
Control System Toolbox Version 24.2 (R2024b)
DSP System Toolbox Version 24.2 (R2024b)
Optimization Toolbox Version 24.2 (R2024b)
Signal Processing Toolbox Version 24.2 (R2024b)
Stateflow Version 24.2 (R2024b)
Statistics and Machine Learning Toolbox Version 24.2 (R2024b)
Thanks in advance
-Bastian I need to implement a real time FFT of the signal in the attached simulink model in order to detect the frequency and phase of the highest peak (it’s a single sinusoid, so it shouldn’t be an issue). As you can see, I’ve set the simulation step to 1/48000. I would like the detection update rate to be 40Hz, so the FFT is run 40 times a second. I’d like the FFT to be run on the newest samples (i.e. 48000/40) plus an overlap of 50% of the previous set (48000/80), so in other words, the latest 1800 samples. I’d like to zero pad this up to the next power of 2.
I was trying to figure out how to do a FIFO buffer that saves the last 1800 samples, but I couldn’t figure that out, and I couldn’t advance past that stage.
In case it helps, here’s what I have:
Simulink Version 24.2 (R2024b)
Control System Toolbox Version 24.2 (R2024b)
DSP System Toolbox Version 24.2 (R2024b)
Optimization Toolbox Version 24.2 (R2024b)
Signal Processing Toolbox Version 24.2 (R2024b)
Stateflow Version 24.2 (R2024b)
Statistics and Machine Learning Toolbox Version 24.2 (R2024b)
Thanks in advance
-Bastian fft MATLAB Answers — New Questions