Storing the Y value of a known X value
4 ビュー (過去 30 日間)
古いコメントを表示
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)
0 件のコメント
回答 (1 件)
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.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Matrices and Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!