Finding upper and lower (min and max) states

2 vues (au cours des 30 derniers jours)
SHANTANU KSHIRSAGAR
SHANTANU KSHIRSAGAR le 12 Avr 2020
Commenté : Star Strider le 14 Avr 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 commentaires
darova
darova le 12 Avr 2020
Can you show something?
SHANTANU KSHIRSAGAR
SHANTANU KSHIRSAGAR le 12 Avr 2020
yes i have figure of some data related to signal

Connectez-vous pour commenter.

Réponses (1)

Star Strider
Star Strider le 13 Avr 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 commentaires
SHANTANU KSHIRSAGAR
SHANTANU KSHIRSAGAR le 14 Avr 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 le 14 Avr 2020
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.

Connectez-vous pour commenter.

Produits


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by