Error in App Designer " Undefined function 'sym2poly' for input arguments of type 'char'.."
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Phil Elamparo
am 6 Mai 2021
Kommentiert: Star Strider
am 6 Mai 2021
Hello. I want to build an application that lets the user input the numerator and the denominator of a transfer function and the code will output the plots for the step response, nyquist, pzmap, and bode. It also calculates the overall transfer function setted in a unity feedback.
The problem is that this error "Undefined function 'sym2poly' for input arguments of type 'char'." pops up and hinders the calculation when I try to run and put inputs for my Edit Text Fields for the numerator and denominator.
Here is my code
And this is what I have entered in my GUI
I tried to remove the association of the givenNum to app.EnterNumeratorEditField.Value , and givenDen to app.EnterDenominatorEditField.Value and replaced actual polynomials to the variable strings in the code itself. By doing this, the error was removed and it calculated an output for the overall transfer function.
And here is what my GUI looks like at this revision of code after clicking "Calculate". (No User-defined Inputs for numerator and denominator)
But i need to make use of a USER-DEFINED numerator and denominator for the graphical input field. And I think that error really is the only thing that stops the program and I honestly don't know how to fix it.
Thank you in advance.
0 Kommentare
Akzeptierte Antwort
Star Strider
am 6 Mai 2021
Apart from the app code, apparently the numerator and denominator polynomials are not being transofmred into symbolic variables.
Try something like this —
syms s
num = str2sym(string(s^2+2*s+1))
den = str2sym(string(s^3+5*s^2-10*s-5))
numMatrix = sym2poly(num)
denMatrix = sym2poly(den)
forwardTransfer = tf(numMatrix, denMatrix)
.
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Develop Apps Using App Designer finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!