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

조회 수: 2 (최근 30일)
%% 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
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 CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by