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 ビュー (過去 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
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.
Timothy Nsubuga
Timothy Nsubuga 2019 年 6 月 20 日
I solved it thanks! I needed to output only the up envelope and pass that on to findpeaks().

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeDescriptive Statistics についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by