Hello, I've a problem with the use of the tf function. Basically i try to build a tf function using ( s = tf('s') ) and then writing my function. It works only with few poles and zeros (it seems just a total of 4), but when i try to write a function with more poles and zeros, and then i try to run it, it just keeps running. Any solution to this problem?

6 件のコメント

Sam Chak
Sam Chak 2022 年 4 月 10 日
Can you show the code for troubleshooting purposes?
Alessandro Romeo
Alessandro Romeo 2022 年 4 月 10 日
s=tf('s')
g=100*(s+10)*(s-5)/(s*(s+8)*(s^2+s+1)*(s-5))
Here it is.
Sam Chak
Sam Chak 2022 年 4 月 10 日
Is this result expected?
g =
100 s^2 + 500 s - 5000
------------------------------------
s^5 + 4 s^4 - 36 s^3 - 37 s^2 - 40 s
Continuous-time transfer function.
Alessandro Romeo
Alessandro Romeo 2022 年 4 月 10 日
Yes, but I don't know why my code keeps running, so it doesn't show me the result.
Sam Chak
Sam Chak 2022 年 4 月 10 日
Try clear everything and see if the problem persists.
clear all
Alessandro Romeo
Alessandro Romeo 2022 年 4 月 10 日
Oh WOW, finally it runs correctly! Thank you very much!

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

 採用された回答

Sam Chak
Sam Chak 2022 年 4 月 10 日

1 投票

I'm glad that the proposed solution works. Just keep in mind that you don't have to clear all every time. You can first check if there is another variable named 's' in the Workspace.
clear all
s = tf('s')
g = 100*(s+10)*(s-5)/(s*(s+8)*(s^2+s+1)*(s-5))

1 件のコメント

Alessandro Romeo
Alessandro Romeo 2022 年 4 月 10 日
Oh, I didn't think about that. I will pay attention to this one. Thank you.

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMATLAB についてさらに検索

製品

リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by