How and what is the time period of following function

7 views (last 30 days)
Andrew Kutsiak
Andrew Kutsiak on 2 Dec 2021
Edited: Jon on 2 Dec 2021
Hi, I am a little bit struggling to find a time period for the folowing code and it's graph.
It is a step response of a RCL circuit and I need to find a time period of it.
R = 1;%Given values
C = 0.01;
L = 0.01;
RC = R*C;
LC = L*C;
sys = tf([1/LC],[1 R/L 1/LC])%upper part and denominator part
subplot(2,1,1)
step(sys)
grid;
subplot(2,1,2)
impulse(sys)
grid;

Answers (2)

Jon
Jon on 2 Dec 2021
Edited: Jon on 2 Dec 2021
I think you are looking for a characteristic time duration for your circuit. One common criteria is the settling time following a step command. Here is some code that would calculate that
R = 1;%Given values
C = 0.01;
L = 0.01;
RC = R*C;
LC = L*C;
sys = tf([1/LC],[1 R/L 1/LC])%upper part and denominator part
% get response data
[yStep,tStep] = step(sys)
% find settling time to step input
% which we define here as the last time it leaves band of +/-3% of final value
settlingThreshold = 0.03; % could use other value here, depends on you criteria
finalValue = 1;
idx = find(abs(yStep - finalValue)/finalValue > settlingThreshold,1,'last');
tSettle = tStep(idx)

Star Strider
Star Strider on 2 Dec 2021
The stepinfo function will give essentially all the relevant information —
R = 1;%Given values
C = 0.01;
L = 0.01;
RC = R*C;
LC = L*C;
sys = tf([1/LC],[1 R/L 1/LC])%upper part and denominator part
sys = 10000 ------------------- s^2 + 100 s + 10000 Continuous-time transfer function.
SI = stepinfo(sys)
SI = struct with fields:
RiseTime: 0.0164 TransientTime: 0.0808 SettlingTime: 0.0808 SettlingMin: 0.9315 SettlingMax: 1.1629 Overshoot: 16.2929 Undershoot: 0 Peak: 1.1629 PeakTime: 0.0359
figure
step(sys)
grid
.
  1 Comment
Jon
Jon on 2 Dec 2021
Thanks, I didn't know about the stepinfo function, very nice!
I see now that I can find that command immediately by Googling the terms: matlab step response settling, also it is on the list searching with these same terms on the internal documentation.
I'll have to remember to search more before writing code!

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!