Storing the Y value of a known X value

조회 수: 1 (최근 30일)
Aero32
Aero32 2021년 1월 22일
답변: Satwik 2025년 4월 25일
Hello,
I have flipped this time series data using flipud and have found the value of 5% of the second to last peak. I want to flip this data back to its original position and figure out the x value that goes with the y value I found earlier. Does anyone know how I can do this?
for k = 1:15 % number of pages
clear pks locs indx threshv df Starts
df = (ButteryFilter(cutoff,samp_freq,abs(derivative(:,1,k))));
[pks,locs] = findpeaks(df,'minpeakprominence',0.01);
threshv = 0.05*abs(pks(end-1)); % 2nd to last peak is first movement
z = locs(end-1) % time of second to last peak
indx=find(df(z:10000)<threshv); % starting from 2nd to last pk, find 5 percent
Starts=indx(1,1) + z;
% find the y point of the index so i can flip and find right time
Start_RT(end+1)= Starts(1,1);
Sub_RT{end+1} = (Start_RT(:,k)) - (target_solutions{:,k}); % reaction time calculation
% RT_Unflipped = flipud(RT_FlipIt)
end
(I am interested in knowing at what time 5% of the value of the second to last peak occurs. I have to unflip this so that the time in ms is correct, the second to last peak is actually the second peak when unflipped)

답변 (1개)

Satwik
Satwik 2025년 4월 25일
If the flipped data has length N and index Starts is found in the flipped data, the corresponding index in the original (unflipped) data is:
Starts_unflipped = N - Starts + 1;
With a time vector t, the associated time value is:
time_at_event = t(Starts_unflipped);
This provides the correct X (time) value for the identified Y after reversing the flip.

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by