How to find settling time?

46 次查看(过去 30 天)
Matthew Worker
Matthew Worker 2020-2-15
编辑: Jon 2020-2-17
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 个评论
Renato SL
Renato SL 2020-2-17
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 2020-2-17
Hi
I know it can be done manually, I want to be able to write a code that will give me the information.
Thanks

请先登录,再进行评论。

回答(1 个)

Jon
Jon 2020-2-17
编辑:Jon 2020-2-17
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

类别

Help CenterFile Exchange 中查找有关 Shifting and Sorting Matrices 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by