How to find settling time?

조회 수: 79 (최근 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