Detecting plateau in a data.

64 次查看(过去 30 天)
Hi All, more info and better clarification in reply.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Hi All,
I have this profile presented in image.
I need to detect the point where the value falls to zero. Forms a plateau. This plateau changes for various experiments so the moving average technique is not efficient.
Currently I can carry out a linear fitting whether I threshold a gradient. However the small number of data points in this set makes it difficult to determine the true value. I was wondering if anyone can guide towards the right direction.
Many thanks

采纳的回答

Image Analyst
Image Analyst 2017-2-12
Why is 81-85 not also a plateau?
You can use diff() or stdfilt() to determine where the variability of your data is low. This will find a plateau at any level. Combine this with ANDing of your data to get plateaus that are low, like less than 0.5 or whatever.
Attach your data for more help.
  3 个评论
Image Analyst
Image Analyst 2017-2-12
How about this:
clc; % Clear the command window.
% close all; % Close all figures (except those of imtool.)
% clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 20;
y = [9.1382875;9.6605644;9.5544062;9.1403189;8.3296022;7.1736870;5.9494658;4.8966575;4.0415068;3.1646166;2.5283923;1.9758664;1.5139828;0.98420805;0.83403659;0.52328163;0.30553690;0.14569098;0.17771824;0.065542839;0.053332146;0.041690052;-0.057317857;0.044289846;-0.0055398578;-0.066662073;-0.032653969;-0.072456174;0.077120677;0.064909987;0.042586125;0.057097465;0.13626869;0.055818811;-0.10009535;0;0;0;0;0;0;0];
subplot(2, 1, 1);
plot(y, 'b.-', 'MarkerSize', 11);
grid on;
xlabel('Index', 'FontSize', fontSize);
ylabel('Y Signal', 'FontSize', fontSize);
title('Standard Deviation', 'FontSize', fontSize);
filteredSignal = stdfilt(y, ones(5, 1));
subplot(2, 1, 2);
plot(filteredSignal, 'b.-', 'MarkerSize', 11);
grid on;
xMax = length(filteredSignal);
xlim([1, xMax]);
xlabel('Index', 'FontSize', fontSize);
ylabel('Standard Deviation of Y', 'FontSize', fontSize);
title('Standard Deviation', 'FontSize', fontSize);
% Find out where the standard deviation is less than 0.2
index = find(filteredSignal < 0.2, 1, 'first');
% Draw a green patch over it
yl = ylim
hold on;
patch([index, index, xMax, xMax, index], ...
[yl(1), yl(2), yl(2), yl(1), yl(1)], ...
'g', 'FaceAlpha', 0.3);
message = sprintf('The plateau indexes start at %d', index)
uiwait(helpdlg(message));
Abhi Ove
Abhi Ove 2017-2-12
编辑:Abhi Ove 2017-2-12
That's amazing. Thanks. I will try it out with the rest of my data sets. Many thanks. I have spent a week trying different fittings/codes and this is just so simple. Many thanks.

请先登录,再进行评论。

更多回答(0 个)

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by