How to find settling time?

46 visualizaciones (últimos 30 días)
Matthew Worker
Matthew Worker el 15 de Feb. de 2020
Editada: Jon el 17 de Feb. de 2020
Hello
I want to be able to find the time taken (number of frames) for each of the peaks to reach the new stabilising value in the graph shown.
Any help would be much appreciated, thank you.
  2 comentarios
Renato SL
Renato SL el 17 de Feb. de 2020
If you can afford to do it manually: in the Figure window use multiple Data Cursors, 1 to point at the time the input was given & 1 to point at the start of the steady-state value. The difference of the x-axis values would be the settling time.
NB: at around Frame=7 (between the last violet star and the next red star), I think there is one peak that is not marked (without a star). I mean, the steady-state value changed.
Daniel Bezchi
Daniel Bezchi el 17 de Feb. de 2020
Hi
I know it can be done manually, I want to be able to write a code that will give me the information.
Thanks

Iniciar sesión para comentar.

Respuestas (1)

Jon
Jon el 17 de Feb. de 2020
Editada: Jon el 17 de Feb. de 2020
Here's a rough approach you might try.
This code will not do the very last epoch, you could further modify to handle this special case.
Also you might have to check a little more on the settling time calculation, should be based on delta from the start of the jump, the logic below may be off by 1 element, I didn't actually test the code. Just wanted to outline a basic approach.
% assume values are in vector x, and corresponding times are in vector t
jumpThreshold = 10; % you can adujst this
settleThreshold = 0.05; % deviation/steadySate at which it is defined to be settled, you can adjust this
% find where jumps occur (also where peaks are).
iPeak = find(abs(diff(x)) >= thresh);
% loop through the jump locations finding how long it take each to settle
numJumps = length(iStart);
settleTime = zeros(numJumps - 1);
for k = 1:numJumps-1
% just work with the points in the current period
xc = x(iPeak:iPeak(k+1)-1);
% assume last point before jump is at steady state
xSS= xc(end);
% find first value that is within settleTimeThreshold
delta = abs(xc - xc(1));
idxSettle = find(abs(delta)/xSS<=settleThreshold,1,'first');
% calculate settle time
settleTime(k) = t(idxSettle) - t(iStart(k));
end

Categorías

Más información sobre Shifting and Sorting Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by