フィルターのクリア

Trying to learn how to add a threshold trigger and peak markers.

2 ビュー (過去 30 日間)
Marshall Harkrider
Marshall Harkrider 2022 年 5 月 20 日
コメント済み: Star Strider 2022 年 5 月 20 日
%% Import Files
signal = 58; %chose column you're interested in in data
processedfilename = ['data1/LT1.txt'];
opts = detectImportOptions(processedfilename)
b = readtable(processedfilename,'ReadVariableNames',true);
LANK_ANG = b(5:end,signal);
pass = table2array(LANK_ANG);
processedfilename = ['data1/LT.txt'];
opts = detectImportOptions(processedfilename)
b = readtable(processedfilename,'ReadVariableNames',true);
LANK_ANG = b(5:end,signal);
pow = table2array(LANK_ANG);
processedfilename = ['data1/LT1.txt'];
opts = detectImportOptions(processedfilename)
b = readtable(processedfilename,'ReadVariableNames',true);
Z__Aaron_PneumaticAnkle_ExportedData_TB30_PassiveEvaluation__56 = b(5:end,signal);
pass = table2array(Z__Aaron_PneumaticAnkle_ExportedData_TB30_PassiveEvaluation__56);
%% Plot Data
signal = 58
figure;
plot(pass(:,1))
hold on
plot(pow(:,1))
plot(601,pass(601,1),'o')
plot(5749,pass(5749,1),'o')
This is my current script. I am currently trying to learn how to add threshold trigger that marks when the red line goes over .95 on the Y axis. I also am trying to find a way to put a marker on all of the peaks of the two lines. I am brand new to matlab and any help would be great. Thanks!
  1 件のコメント
Marshall Harkrider
Marshall Harkrider 2022 年 5 月 20 日
Please let me know if there is any missing info I could provide that would be of assistance.

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

採用された回答

Star Strider
Star Strider 2022 年 5 月 20 日
Try something like this —
x = linspace(0,10,500);
red_line = sin(2*pi*x)*1.5;
trigger = find(diff(sign(red_line - 0.95)));
figure
plot(x, red_line, '-r')
hold on
plot(x(trigger), 0.95*ones(size(trigger)), 'xb', 'MarkerSize',10)
hold off
grid
Make appropriate changes to work with your code and data.
.
  2 件のコメント
Marshall Harkrider
Marshall Harkrider 2022 年 5 月 20 日
Thank you!!
Star Strider
Star Strider 2022 年 5 月 20 日
As always, my pleasure!
With respect to the peaks, use findpeaks or islocalmax. (My apologies for not including those originally.)

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

その他の回答 (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