Scripting: export FFT between Scope cursors

Hi,

I’m doing some scripting in Standalone. After each simulation iteration I set the cursors of a scope to the last 10 periods of a periodic signal, I’m exporting rms, max, min values as well as the bitmap of the scope. Now I would like to export also the Fourier amplitudes of the last 1 period and store the values in a file. Is this possible with scripting?

It is not possible to access the FFT in the PLECS Scope via the PLECS scripting interfaces. For the moment, the only solutions are to perform the FFT analysis using the ‘Fourier Transform’ block or to export the signal that should be analyzed, and perform the FFT analysis in post processing.

The Octave distribution with PLECS standalone includes the fft() function. Attached is a simple example where the PLECS simulation results are post processed using Octave. Note the return of values of the fft() function require some manipulation to return the single sided amplitude spectrum that is shown in the PLECS Scope.

fft_postprocess.plecs (7.72 KB)

1 Like

Thanks a lot for the fast reply and the example.

I think I’ll try your proposal with post processing using Octave. In fact I found two important things in your example:

  1. How to set up regularly sampled output data

  2. FFT post processing

The control system in my simulation takes some time to reach steady state. I have to understand now, how to export exactly one complete period in steady state at the end of the simulation as input vector for the fft post processing.