Matlab 2023a: How can I set Window Length and NFFT in the Spectrum Analyser block in Simulink?
22 views (last 30 days)
Show older comments
The spectrum setting for the Spectrum Analyser in Simulink Matlab 2023a don't appear to allow direct adjustment of the Window Length and NFFT. They could easily be set in previous versions. Is there a way to change these settings?
0 Comments
Accepted Answer
Vandit
on 2 Feb 2024
Hi Donal,
I understand that you are facing difficulty in changing the 'Window Length' and 'NFFT' in the Spectrum Analyzer block in MATLAB R2023a.
From the below documentation, it looks like there is a change in the GUI of the Spectrum Analyzer block:
One workaround is to use the "set_param" and "get_param" functions, which are used to modify and retrieve block parameters in Simulink, respectively. Kindly refer to the following code snippet for modifying the 'Window Length' and 'NFFT' in the Spectrum Analyzer block:
% Get the current block path
>> gcb
ans =
'untitled/Spectrum Analyzer'
% Get the current Window Length
>> get_param(gcb,'WindowLength')
ans =
'1000'
% Set the Window Length to 1024 and verify the Window Length has been updated
>> set_param(gcb,'WindowLength','1024')
>> get_param(gcb,'WindowLength')
ans =
'1024'
% Get the current FFT Length (NFFT)
>> get_param(gcb,'FFTLength')
ans =
'256'
% Set the FFT Length to 1024 and verify the FFT Length has been updated
>> set_param(gcb,'FFTLength','1024')
>> get_param(gcb,'FFTLength')
ans =
'1024'
To know more about "set_param" and "get_param" functions, please refer to below documentations:
Hope this helps.
More Answers (0)
See Also
Categories
Find more on Model, Block, and Port Callbacks 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!