Extracting amplitude and frequency component using short time Fourier transform

19 views (last 30 days)
I need to calculate the capacitance and equivalent series resistance (ESR) of a capacitor in a Boost converter. My boost converter simulation is simulated on Simulink and I am exporting the values to Matlab. The ESR and C values can be achieved by measuring the voltage across and current through the output capacitor and using a short time Fourier transform (STFT) method. The mathematical equations require the amplitudes of the voltages and currents at both the fundamental (=60Hz) and the switching frequency ( = 5kHz) harmonics.
, ,
[Vfsw,fsw_Vc,t_fsw_Vc] = stft(Vc,fsw,'Window',hamming(128,'periodic'),'OverlapLength',50);
Vfsw = Vfsw(128,:);
[Ifsw,fsw_Ic,t_fsw_Ic] = stft(Ic,fsw,'Window',hamming(128,'periodic'),'OverlapLength',50);
Ifsw = Ifsw(128,:);
[Vfm,fm_Vc,t_fm_Vc] = stft(Vc,fm,'Window',hamming(128,'periodic'),'OverlapLength',50);
Vfm = Vfm(128,:);
[Ifm,fm_Ic,t_fm_Ic] = stft(Ic,fm,'Window',hamming(128,'periodic'),'OverlapLength',50);
Ifm = Ifm(128,:);
C = Ifm/(2*pi*fm_Vc*Vfm);
ESR = Vfsw/Ifsw;
My final ESR and C values are quite different than the expected values. Am I extracting the amplitude and frequency component values correctly?

Answers (1)

Shreshth
Shreshth on 7 Feb 2024 at 6:18
Edited: Shreshth on 7 Feb 2024 at 6:20
Hello Sudarshan,
Through the code provided, I can understand that you are aiming to extract amplitudes at 60Hz and 5KHz to determine the capacitance and ESR of a capacitor in a boost converter using STFT (Short Time Fourier Transform) function.
However there are couple of issues I can point out that might be resulting in the discrepancy of the final ESR (equivalent series resistance) and C (capacitance) values.
  1. Frequency Indexing: The way you're indexing the results of the STFT might not correspond to the exact frequencies you're interested in. You're using the 128th element (Vfsw(128,:), Ifsw(128,:), etc.), which doesn't necessarily correspond to the 60 Hz or 5 kHz components unless the frequency resolution of the STFT exactly matches these frequencies.
  2. Amplitude Extraction: The STFT returns complex values representing both amplitude and phase information. To get the amplitude, you should take the absolute value (abs ()) of the complex result.
Additionally, you can use the ‘min’ function to find the indices (‘fsw_index’ and ‘fm_index’) that are closest to the switching and the fundamental frequencies.
For more information about the use of ‘min’ or ‘max’ functions in MATLAB you can refer to the below link to find further details,
Hope it helps,
Regards,
Shubham Shreshth

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!