How and what is the time period of following function
5 次查看(过去 30 天)
显示 更早的评论
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;
0 个评论
回答(2 个)
Jon
2021-12-2
编辑:Jon
2021-12-2
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)
0 个评论
Star Strider
2021-12-2
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
SI = stepinfo(sys)
figure
step(sys)
grid
.
1 个评论
Jon
2021-12-2
编辑:Jon
2021-12-2
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!
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Pole and Zero Locations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!