How to find settling time?

79 vues (au cours des 30 derniers jours)
Matthew Worker
Matthew Worker le 15 Fév 2020
Modifié(e) : Jon le 17 Fév 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 commentaires
Renato SL
Renato SL le 17 Fév 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 le 17 Fév 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

Connectez-vous pour commenter.

Réponses (1)

Jon
Jon le 17 Fév 2020
Modifié(e) : Jon le 17 Fév 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

Catégories

En savoir plus sur Shifting and Sorting Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by