I am trying to update some code that uses the deprecated function PSD to use PWELCH instead.Can anyone help me for solving this problem

3 次查看(过去 30 天)
I want to update the following code instead of using PSD,because when I excute the following code I will get on the following message " psd has been removed use periodogram or pwelch instead ",I must to use another one like pwelch or periodogram,so I need anyone please to update my code.
I have the following code
function value = aubt_getSpecRange (data, hz, r1, r2)
% Expects as input a signal vector and estimates the mean of the frequency
% spectrum in a given range.
%
% values = aubt_getSpecRange (data, hz, r1, r2)
%
% input:
% data: signal vector
% hz: samplerate of the input signal(s)
% r1: lower bound of the frequeny band
% r2: upper bound of the frequeny band
%
% output:
% values: mean of the frequency spectrum
len = length (data);
spec = psd (data, len, hz/2);
spec = spec / sum (spec);
hzPerSample = hz / len;
spec = spec (ceil (r1/hzPerSample)+1:floor (r2/hzPerSample)+1);
if isempty (spec)
value = 0;
else
value = mean (spec);
end

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Spectral Estimation 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by