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 views (last 30 days)
Show older comments
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 Comments
Answers (0)
See Also
Categories
Find more on Spectral Estimation 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!