Matlab 2023a: How can I set Window Length and NFFT in the Spectrum Analyser block in Simulink?
21 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Vandit
le 2 Fév 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.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Model, Block, and Port Callbacks dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!