I am getting the following error in my code: "Undefined function or variable 'helperFrequencyAnalysisPlot2'." How do I correct this error?
Afficher commentaires plus anciens
function [domPks, domF, medF] = domFreqs(d, Fs, n, plots) %UNTITLED Summary of this function goes here % Detailed explanation goes here
% Input % d: data % Fs: sampling freq % n: number of dominant frequenies to return % plots: = 1 to display plots
NFFT = length(d); % Number of FFT points
F = (0 : 1/NFFT : 1/2-1/NFFT)*Fs; % Frequency vector
TEMP = fft(d,NFFT);
TEMP(1) = 0; % remove the DC component for better visualization
[pksTemp,~] = findpeaks(abs(TEMP(1:floor(NFFT/2))));
% Sort frequency peaks
pks = sort(pksTemp,1,'descend');
for i = 1:n
loc(i) = find(abs(TEMP(1:floor(NFFT/2))) == pks(i));
end
if plots == 1
% Plot 1st and 2nd dominant peaks
helperFrequencyAnalysisPlot2(F,abs(TEMP(1:floor(NFFT/2))),...
'Frequency (cycles/s)','Magnitude',[],[],[0 5])
hold on
plot(F(loc),pks(1:n),'ro')
end
domPks = pks(1:n);
domF = F(loc(1:n));
medF = median(pks);
end
Réponses (1)
Walter Roberson
le 2 Jan 2018
0 votes
Chances are that you are trying to use an example code with a version of MATLAB earlier than what the example was designed for.
Which MATLAB version are you using?
Catégories
En savoir plus sur Descriptive Statistics dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!