Finding upper and lower (min and max) states

3 visualizaciones (últimos 30 días)
SHANTANU KSHIRSAGAR
SHANTANU KSHIRSAGAR el 12 de Abr. de 2020
Comentada: Star Strider el 14 de Abr. de 2020
I have signals which contaiin multiple pulses which somewhat vary from each other. I am calculating the upper(max) and lower(min) states of each pulse in order to calculate rise and fall time for each indivisual pulse. As i have only the basic matlab with me ,i cannot make use of the functions risetime, statelevels which would calculate the required accurately , so proceeding mathematically.
  2 comentarios
darova
darova el 12 de Abr. de 2020
Can you show something?
SHANTANU KSHIRSAGAR
SHANTANU KSHIRSAGAR el 12 de Abr. de 2020
yes i have figure of some data related to signal

Iniciar sesión para comentar.

Respuestas (1)

Star Strider
Star Strider el 13 de Abr. de 2020
The 'movmedian' method works as well as 'sgolay', and appears to produce essentially the same result. It is a core MATLAB function introduced in R2016a. You should have it.
There is nothing in the documentation that says the 'sgolay' method requires the Signal Processing Toolbox, so I assumed it was implemented independently.
T = readtable('data.xlsx');
T.Var3 = smoothdata(T.Var2, 'movmedian', 3000);
[Lc,m,b] = ischange(T.Var3, 'linear', 'Threshold',5);
Cix = find(Lc);
Ic = [Cix m(Cix) b(Cix) T.Var1(Cix,:) T.Var2(Cix,:)]; % Consolidation Matrix
risetime = Ic(2:4:end,4) - Ic(1:4:end,4);
falltime = Ic(4:4:end,4) - Ic(3:4:end,4);
statelo = Ic(1:4:end,5);
statehi = Ic(3:4:end,5);
figure
plot(T.Var1, T.Var2)
hold on
plot(T.Var1, T.Var3, '-r')
plot(T.Var1(Cix), T.Var3(Cix), 'pg', 'MarkerFaceColor','g')
hold off
grid
legend('Original Data', 'Smoothed Data', 'Change Points', 'Location','E')
The smoothing method is all that is changed here. Experiment with the window length in the smoothdata call (3000 in my code) to get different results. (I am using R2020a.)
.
  4 comentarios
SHANTANU KSHIRSAGAR
SHANTANU KSHIRSAGAR el 14 de Abr. de 2020
Yes I do not have the toolboxes on the system at my workplace. Currently I am working from home on my indivisual system so I could send you the another result. Really appritate your code , it is robust, I will work on it to get the results. Thank you .
Star Strider
Star Strider el 14 de Abr. de 2020
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.

Iniciar sesión para comentar.

Etiquetas

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by