How to show TF function in GUI text box

s = tf('s');
Gc =(s+1/T)/(s+1/(beta*T));
set(handles.TF,'string',Gc);
it showing some error

 채택된 답변

Walter Roberson
Walter Roberson 2021년 8월 7일

0 개 추천

s = tf('s');
T = randi([2 20])
T = 4
beta = rand()
beta = 0.0620
Gc =(s+1/T)/(s+1/(beta*T));
then
Gcstr = "(" + strtrim(poly2str(Gc.num{1}, 's')) + ")/(" + strtrim(poly2str(Gc.den{1}, 's')) + ")"
Gcstr = "(s + 0.25)/(s + 4.0313)"
If you have the Symbolic Toolbox you could also do
Gcstr = string(vpa(poly2sym(Gc.num, sym('s')) / poly2sym(Gc.den, sym('s')),5))
Gcstr = "(s + 0.25)/(s + 4.0313)"
After you have Gcstr created you can set the String property of your field to Gcstr .

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Dynamic System Models에 대해 자세히 알아보기

태그

질문:

RJS
2021년 8월 7일

답변:

2021년 8월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by