matlab零极点增益模型,[求助]怎么在GUI里面实现零极点增益计算

多谢指教。

参考了你的意见,我整理下代码:

function Untitled3

h0=figure('toolbar','none',...

'position',[20 20 800 600],...

'name','倒立摆系统稳定性实验');

h1=axes('parent',h0,...

'position',[1 1 0.9 0.9],...

'visible','off'); %#ok

b1=uicontrol('parent',h0,...

'units','points',...

'tag','b1',...

'fontsize',15,...

'style','text',...

'string','M',...

'backgroundcolor',[0.75 0.75 0.75],...

'position',[80 350 40 20],...

'callback',[...

'M=str2num(get(c1,''string''));',...

]);

b2=uicontrol('parent',h0,...

'units','points',...

'tag','b2',...

'fontsize',15,...

'style','text',...

'string','m',...

'backgroundcolor',[0.75 0.75 0.75],...

'position',[80 320 40 20],...

'callback',[...

'm=str2num(get(c2,''string''));',...

]);

b3=uicontrol('parent',h0,...

'units','points',...

'tag','b3',...

'fontsize',15,...

'style','text',...

'string','l',...

'backgroundcolor',[0.75 0.75 0.75],...

'position',[80 290 40 20],...

'callback',[...

'l=str2num(get(c3,''string''));',...

]);

b4=uicontrol('parent',h0,...

'units','points',...

'tag','b4',...

'fontsize',15,...

'style','text',...

'string','b',...

'backgroundcolor',[0.75 0.75 0.75],...

'position',[80 260 40 20],...

'callback',[...

'b=str2num(get(c4,''string''));',...

]);

b5=uicontrol('parent',h0,...

'units','points',...

'tag','b5',...

'fontsize',15,...

'style','text',...

'string','I',...

'backgroundcolor',[0.75 0.75 0.75],...

'position',[80 230 40 20],...

'callback',[...

'T=str2num(get(c5,''string''));',...

]);

b6=uicontrol('parent',h0,...

'units','points',...

'tag','b5',...

'fontsize',15,...

'style','text',...

'string','T',...

'backgroundcolor',[0.75 0.75 0.75],...

'position',[80 200 40 20],...

'callback',[...

'T=str2num(get(c6,''string''));',...

]);

c1=uicontrol('parent',h0,...

'units','points',...

'tag','c1',...

'style','edit',...

'fontsize',15,...

'string','0.5',...

'backgroundcolor',[0 1 0],...

'position',[120 350 40 20]);

c2=uicontrol('parent',h0,...

'units','points',...

'tag','c2',...

'style','edit',...

'fontsize',15,...

'string','0.3',...

'backgroundcolor',[0 1 0],...

'position',[120 320 40 20]);

c3=uicontrol('parent',h0,...

'units','points',...

'tag','c3',...

'style','edit',...

'fontsize',15,...

'string','0.2',...

'backgroundcolor',[0 1 0],...

'position',[120 290 40 20]);

c4=uicontrol('parent',h0,...

'units','points',...

'tag','c4',...

'style','edit',...

'fontsize',15,...

'string','0.1',...

'backgroundcolor',[0 1 0],...

'position',[120 260 40 20]);

c5=uicontrol('parent',h0,...

'units','points',...

'tag','c5',...

'style','edit',...

'fontsize',15,...

'string','0.006',...

'backgroundcolor',[0 1 0],...

'position',[120 230 40 20]);

c6=uicontrol('parent',h0,...

'units','points',...

'tag','c6',...

'style','edit',...

'fontsize',15,...

'string','0.005',...

'backgroundcolor',[0 1 0],...

'position',[120 200 40 20]);

c7=uicontrol('parent',h0,...

'units','points',...

'tag','c7',...

'style','edit',...

'fontsize',15,...

'string','',...

'backgroundcolor',[0.75 0.75 0.75],...

'position',[300 150 120 50]);

function c8huidiao(obj,event)  %#ok

Str1='系统不稳定';

Str2='系统稳定';

q=(M+m)*(I+m*l^2)-(m*l)^2;

num=[m*l/q 0 0];

den=[1 b*(I+m*l^2)/q -(M+m)*m*g*l/q -b*m*g*l/q 0] ;

[r,p,k]=residue(num,den);

s=p;

if (real(s)>0)

set(c7,'string',Str1);

end

if (real(s)<=0)

set(c7,'string',Str2);

end

end

c8=uicontrol('parent',h0,...

'units','points',...

'tag','c8',...

'fontsize',15,...

'style','pushbutton',...

'string','result',...

'backgroundcolor',[1 0 0],...

'position',[200 150 80 50],...

'callback',{@c8huidiao});

end

在运行时,不知怎么会出现变量没定义的问题。要回去了,我就不多说了,希望你有空,给点意见。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值