can anyone explain what this piece of code do?

6 ビュー (過去 30 日間)
ajit
ajit 2022 年 8 月 2 日
回答済み: Abderrahim. B 2022 年 8 月 2 日
  1 件のコメント
KSSV
KSSV 2022 年 8 月 2 日
Read about help

サインインしてコメントする。

回答 (1 件)

Abderrahim. B
Abderrahim. B 2022 年 8 月 2 日
Hi!
Your code does the basic Model Interconnection and some LTI system analysis (poles zeros plot).
Try to learn from the documentation:
doc tf
doc series
doc parallel
doc feedback
doc pzmap
Transfer function g1:
num = 10 ; % numerator
den = [1 5 0] ; % denominator
g1 = tf(num, den)% tf: transfer function
g1 = 10 --------- s^2 + 5 s Continuous-time transfer function.
Transfer function g2:
num1 = [1 1] ; % numerator
den1 = [1 0] ; % denominator
g2 = tf(num1, den1)% tf: transfer function
g2 = s + 1 ----- s Continuous-time transfer function.
Transfer function sal, pal:
g1 and g2 are cascade, which means sal = g1 x g2 (multiplication). using series function you can compute this.
sal = series(g1, g2)
sal = 10 s + 10 ----------- s^3 + 5 s^2 Continuous-time transfer function.
g1 and g2 are parallel, which means pal = g1 + g2 (addition). using parallel function you can compute this.
pal = parallel(g1, g2)
pal = s^3 + 6 s^2 + 15 s ------------------ s^3 + 5 s^2 Continuous-time transfer function.
Closed loop transfer functions:
feedback function allows connecting models to calculate closed loop tf. Learn more about closed loop transfer function.
  • feedback transfer function has a gain of 1.
pfeb = feedback(g1, g2, 1)
pfeb = 10 s ----------------------- s^3 + 5 s^2 - 10 s - 10 Continuous-time transfer function.
  • feedback transfer function has a gain of -1.
nfeb = feedback(g1, g2, -1)
nfeb = 10 s ----------------------- s^3 + 5 s^2 + 10 s + 10 Continuous-time transfer function.
  • Closed loop tf from g1 and 1 .
ufb = feedback(g1, g2, -1)
ufb = 10 s ----------------------- s^3 + 5 s^2 + 10 s + 10 Continuous-time transfer function.
Pole Zero Plots:
I assume you know about this plot.
pzmap(g1)
figure % new figure
pzmap(g2)
Hope this helps

カテゴリ

Help Center および File ExchangeDigital Filter Analysis についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by