Along with greeting, I attach 2 .txt files, one for amplitudes and the other for flow, which are 1441x50, where each column represents different simulations and the rows are the variation of the parameter (both amplitude and flow) as a function of time (for that I define a time vector). The problem I have is how to define both for the case of amplitude and flow, the time interval (x axis), where the maximum peak is found but considering the entire wave of said peak, and unfortunately all the scenarios are very different, then I wanted to ask for help to define some criteria or method to get the time range.
I present two figures that show in a schematic way what I need (I did it visually by seeing the maximum peak and defined the interval by seeing the wave that contained it), but I need it in numerical form, I mean to quantify that interval, and define a criterion to be able to perform it for all simulations, in total there are 50 simulations.
In red vertical lines I defined an interval considering the wave where the peak value is, but it was done by eye, so I need your help to be able to do it automatically with matlab and defining a criterion to be able to do it, since as I mentioned earlier the simulations are very different.
close all, clear all, clc
figure, plot(t,amplitude(:,1)) , ylabel('Amplitude (m)') , xlabel('Time (s)')
figure, plot(t,flow(:,1)) , ylabel('Flow (m^3/s)') , xlabel('Time (s)')