How come findpeaks() is giving me the error: Error in findpeaks (line 136) = parse_inputs(isInMATLAB,Yin,varargin{:}); I want to get the first peak of an envelope I made...
1 次查看(过去 30 天)
显示 更早的评论
%%This fucntion will graph waveforms and their hilbert transform from one
%%waveform .csv file
%%must add labeling for first peak and this function needs an input
%**************************************************************************
function g = graphData(file)
newStr = extractBetween(file,"_","_"); %get transducer name
table = readtable(file); %read the data into a table
xr = table2array(table); %convert the table into an array(matrix)
x = xr(:,1);
y = xr(:,2);
[up,lo] = envelope(y); %attain the hilbert envelope fo the amplitude
Y = [up,lo];
% M = find([up,lo] == max(m)); %find the max amplitude of the hilbert transform envelope
[pks,locs] = findpeaks(Y);
g = plot( x,y, x, up,'-p','MarkerIndices',...
'MarkerFaceColor','blue',...
'MarkerSize',10 ); %plot time vs. amplitude vs. hilbert and mark max amplitude of hilbert
xlabel('Time (seconds)');
ylabel('Volts');
title("Peak in Hilbert Transform of Signal");
legend("Transducer" + " " + newStr);
end
3 个评论
Steven Lord
2019-6-20
Show us the full text of the error message you received. That means all the text displayed in red. Knowing what error findpeaks threw should help us understand why findpeaks threw that error.
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!