Detecting maximum and minimum of signal
Show older comments
Hey guys,
I'd like to write some code which finds the mean stress and stress amplitude for each block of a signal whose amplitude changes from one constant value to another (pictured below).

In order to do this, I need the maximum and minimum values for each block of the signal. The only problem is that my program should be able to read any signal with multiple blocks of constant amplitude so the method needs to be general and not just for the example below.
Any help would be greatly appreciated :)
Accepted Answer
More Answers (2)
Jan
on 9 Jan 2013
2 votes
Start with finding the local extrema, e.g. by:
- http://www.mathworks.com/matlabcentral/fileexchange/30490-1d-non-derivative-peak-finder
- http://www.mathworks.com/matlabcentral/fileexchange/33555-find-zeros-local-maximums-loacal-minimums
- http://www.mathworks.com/matlabcentral/fileexchange/26581-peakseek
- ... search in the FileExchange for more
Then locating the blocks should be easy, when you can define a threshold value to identify a switch.
Image Analyst
on 9 Jan 2013
Edited: Image Analyst
on 9 Jan 2013
How about:
minValue = min(theBlock(:));
maxValue = max(theBlock(:));
You only asked about finding the min and max value. You didn't ask about locating the blocks themselves, so presumably you already have a way of doing that. If not, I posted a method for that about a month or two ago involving conv() and thresholding I think.
You said your " program should be able to read any signal". I'm not sure what this means, but perhaps you need to get the Data Acquisition Toolbox if you need to read from an instrument, or perhaps fread(), dlmread(), importdata() or something like that if you need to read it from a file. If you have some other definition of read, let's hear it.
Categories
Find more on Signal Operations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!