How do I write the code for entering a numerator and denominator polynomials in GUI and to use it for trasnfer function?

1 次查看(过去 30 天)
I want to create a transfer function from numerator and denominator polynomials using GUI matlab code. But I am pretty new to GUI. I stuck in writing the code. for example numerator polynomials are [0 0 0 1] and the denominator polynomials are [1 6 11 6], The transfer function should be 1/(s^1+6s^2+11s+6)
Help me out.
Thanks in advance.

采纳的回答

Birdman
Birdman 2017-12-4
I assume the text fields that you write in GUI take string as variables. Therefore enter the coefficients as follows:
0,0,0,1
1,6,11,6
Then first use strsplit command to separate each value and get rid of the comma, and then use str2double or str2num command to convert them to numerical values. Then write the following command, imagine you assigned converted variables to num and den variables respectively:
Gs=tf(num,den)
By the way, if the text areas take input directly as double, then just write the command above.
Hope it helps.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by