MATLAB: How to find the average pressure before a sharp dip

average valuediscontinuityfirst derivative testMATLABmaximum valuesignal processingstandard deviation

Hello,
I have a pressure vs. time plot as shown. There is obviously quite a bit of noise in the signal. How could I find the average pressure (~30 psi) before the sharp dip? The only code I wrote so far is to plot the image here. It seems that standard deviation or the first derivative test could be used, but I have not found any examples similar to mine.
Thank you.

Best Answer

Is the drop always as markedly different from the level of noise? And does it happen in one big drop down? If so, then you could use
>> [biggestDrop idx] = min(diff(pressure)); % Index will be to the point just before drop
to find the drop, and then
>> meanBeforeDrop = mean(pressure(idx-9:idx)); % Averaging the prior ten points
If not, of course the problem will be more challenging. If that's the case, maybe post am image that is something akin to your worst-case scenario for identification.
Related Question