Clear Filters
Clear Filters

How come findpeaks() is giving me the error: Error in findpeaks (line 136) = parse_inpu​ts(isInMAT​LAB,Yin,va​rargin{:})​; I want to get the first peak of an envelope I made...

4 views (last 30 days)
%%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 Comments
Steven Lord
Steven Lord on 20 Jun 2019
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.

Sign in to comment.

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!