Algorithm required to detect different phases of a real time data/signal.

4 views (last 30 days)
Hi, In the attached file we have ploted (red color), the performance of an processor vs number of ticks. The plot shows different behavior or phases during different ticks/execution. We want to mark these different phases as shown in the last figure (clipboard02) with black lines. All we need to do, is to write a CODE that we can automatically mark the change in the behavior as a phase, as shown in Figure (Clipboard) manually. Help from relevant experts would be appreciated. Thanks

Accepted Answer

Elizabeth Reese
Elizabeth Reese on 21 Aug 2017
First, you will need to establish some criteria for what a "phase change" should be. After doing this, you can use logical indexing to determine where the phase changes occur and then plot the thick black lines.
One way to determine a phase change is based on the "diff" function which calculates the difference between adjacent values in a vector. I have attached an example demonstrating this technique. Using the pure differences will be sensitive to noise in the data.
Another way to determine a phase change is based on deviation from the moving mean. For example, if you calculate the moving mean using the "movmean" function, you can compare the mean of the previous 10 ticks against the next tick. When the discrepancy between these values reaches a certain threshold, you have hit a new phase.
Once you have formalized what conditions indicate a phase change, you can follow the for-loop in the example and plot the horizontal and vertical lines.
  1 Comment
Qazi  Arbab Ahmed
Qazi Arbab Ahmed on 22 Aug 2017
Thanks Liz. The example is quite helpful. I need to change the phases, As I want to include certain small number of fluctuation in the same phase until it appears more than twice. I will do this and will back to you. Thanks again.

Sign in to comment.

More Answers (0)

Categories

Find more on 2-D and 3-D Plots 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!