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

1 view (last 30 days)
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.

Accepted Answer

Birdman
Birdman on 4 Dec 2017
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.

More Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!