Frequency and magnitude in the same column when I export FFT data to CSV from Qspice

Frequency and magnitude in the same column when I export FFT data to .CSV from Qspice. I was expecting the frequency to be in one column and the magnitude and angle in one column, the same as in LTspice.
I want to plot the.csv data in MATLAB, but I’m struggling with how to fix the above issue or how to plot it in MATLAB by accessing only the magnitude values from the column data which has both Frequency and magnitude.

Any idea…

Thanks.

1 Like

can you give me an example and I see how you can plot it in matlab?

Thank you @KSKelvin.

Here is the screenshot from the.csv file. The first column, Frequency, has two elements separated by space or tab. I want to access both elements row-by-row in Matlab. That is, the first element in the x-axis and the second in the y-axis.

image

I dont know about the data format for FFT.

However, I just did .ac analysis, and I realized that the data I got after export is in format of:
Freq, Real, Imaginary

So, to convert into Mag and Phase in matlab, you need to do this
Complex = Real + 1jImaginary
Mag = 20
log10(complex)
Phase = 180/pi*arg(complex)

I dunno if FFT take the same format, but it seems to be likely from your snippet

Goto my github, in Matlab2Qspice, download these two files
Qspice/Matlab2Qspice at main · KSKelvin-Github/Qspice

  • Matlab2Qspice_example_FFT_Qraw.m
  • qraw_parser.m

After you run FFT, don’t close waveform viewer and just copy .fft.qraw (you don’t have to export into .csv and can directly play with .qraw file… spent many hours figure out how to load a binary format .qraw so we can play with .qraw in matlab directly).
Run Matlab2Qspice_FFT_Qraw.m and read your fft.qraw and you should get FFT plot in matlab.

image

Great, thank you @KSKelvin.