Detecting plateau in a data.

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

 Respuesta aceptada

Image Analyst
Image Analyst el 12 de Feb. de 2017

0 votos

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 comentarios

Abhi Ove
Abhi Ove el 12 de Feb. de 2017
Editada: Abhi Ove el 12 de Feb. de 2017
Hi Image Analyst,
I have this intensity profile inside an instrument. On the left hand side of the 0 (from x = 81:85) it provides me with calibration intensity. Beyond this position my sample provides intensity, until the outer wall beyond x=120. From this profile. I have to detect the plateau at around 113. The shape of this plateau can change as well as the zero intensity region at x axis. I have tried stdfilt() which gives me another plateau noisy region. Any help will be much appreciated.
Here is the intensity data for one such profile (only the signal generated from the sample beyond x=85.
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];
Image Analyst
Image Analyst el 12 de Feb. de 2017
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 el 12 de Feb. de 2017
Editada: Abhi Ove el 12 de Feb. de 2017
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.

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Preguntada:

el 12 de Feb. de 2017

Editada:

el 12 de Feb. de 2017

Community Treasure Hunt

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

Start Hunting!

Translated by