Storing the Y value of a known X value
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Satwik
le 25 Avr 2025
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 commentaires
Voir également
Catégories
En savoir plus sur Matrices and Arrays dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!