Find maxima in proximity
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have 2 timetables with data covering the same time period at 2 different intervals.
I want to find the local maxima in the Q timetable ('st_Q_exert') that is within a 24 hour window of the daily T ('st_T_exert') maximum.
I grouped them together using:
TT = synchronize(st_T_exert,st_Q_exert,'union', 'linear');
First, I need the daily T max. I did this using:
dailyTemp= reshape(TT.Temp(1:end-1),288,[]);
>> [valT,indT]=max(dailyTemp);
indT gives me the index of each day where the maxima occured. I would now like to find the maximas of the other data table in a 24 hour window around these indexes.
for i=2:length(indT)
idxT_all(i)=indT(i)+288*(i-1);
end
This expands the indexing for the entire data set.
I would now like to do "search" the st_Q_exert in a window of size 288 around the indexes saved in idxT_all for the nearest maxima of Q around maxima of T.
0 commentaires
Réponses (1)
sai charan sampara
le 4 Mar 2024
Hello Raphael,
I understand you are trying to find the maximums in “st_Q_exert” around known indices of maximums in “st_T_exert” with a window of length 288. It can be done as follows:
load("Q_excerpt.mat");
load("T_excerpt.mat");
TT = synchronize(st_T_exert,st_Q_exert,'union', 'linear');
dailyTemp= reshape(TT.Temp(1:end-1),288,[]);
[valT,indT]=max(dailyTemp);
for i=2:length(indT)
idxT_all(i)=indT(i)+288*(i-1);
end
max_q=[];
for i=1:length(idxT_all)
lower_limit=idxT_all(i)-143;
upper_limit=idxT_all(i)+144;
if lower_limit<1
lower_limit=1;
end
if upper_limit>size(st_Q_exert,1)
upper_limit=size(st_Q_exert,1);
end
max_q(i)=max(st_Q_exert{lower_limit:1:upper_limit,"Q"});
end
max_q
0 commentaires
Voir également
Catégories
En savoir plus sur Data Types 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!