How to access the data from the FFT Analysis tool in the Powergui and use in the workspace
2 views (last 30 days)
Show older comments
hi
I simulate the circuit in Simulink Matlab and measures its fft using FFT analysis tool in the powergui. now I want to access the values of each harmonic, and THD, and use it in the workspace. I find the related question in the following URL.
https://www.mathworks.com/matlabcentral/answers/99089-how-can-i-access-the-data-from-the-fft-analysis-tool-in-the-powergui-from-the-matlab-command-prompt
sps = power_fftscope(bdroot)
%Sampling time
Ts = sps.FFTdata.t(2)-sps.FFTdata.t(1)
%Samples per cycle
Sc = 1/(Ts*sps.fundamental)
%DC component
DC = sps.mag(1)
%Fundamental frequency
Fc = sps.fundamental
%Total harmonic distortion
THD = sps.THD
I name the scope as voltage. run the Simulink file.then I go to command line and execute the first line of the code.
when I execute first line
sps = power_fftscope(bdroot)
answer comes: sps = []
then next line execute:
Ts = sps.FFTdata.voltage(2)-sps.FFTdata.voltage(1)
this error comes
Attempt to reference field of non-structure array.
what does it means and how to get the data from the FFT` analysis. kindly help me I will be highly thankful to you
0 Comments
Answers (1)
Sophia Hofmann
on 27 Jul 2018
Have you found a solution for your problem? I get the same message and need some help.
0 Comments
See Also
Categories
Find more on Spectral Measurements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!