前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Matlab绘制不同阻尼下的系统响应

Matlab绘制不同阻尼下的系统响应

作者头像
用户9925864
发布2022-07-27 09:25:43
7810
发布2022-07-27 09:25:43
举报
文章被收录于专栏:算法工程师的学习日志

基于Matlab的GUI设计不同阻尼的系统响应

代码语言:javascript
复制

h0=figure('toolbar','none',...
    'position',[198 56 350 468],...
    'name','test');
h1=axes('parent',h0,...
    'position',[0.25 0.45 0.5 0.5],...
    'visible','off');
str1='当前阻尼比=';
z=0.52;
t=0:0.1:10;
y=step(1,[1 2*z 1],t);
hline=plot(t,y);
grid on
r1=uicontrol('parent',h0,...
    'units','points',...
    'tag','r1',...
    'style','radio',...
    'string','grid on',...
    'position',[30 120 60 20],...
    'backgroundcolor',[0.75 0.75 0.75],...
    'value',1,...
    'callback',[...
        'grid on,',...
        'set(r1,''value'',1);,',...
        'set(r2,''value'',0)']);
r2=uicontrol('parent',h0,...
    'units','points',...
    'tag','r2',...
    'style','radio',...
    'string','grid on',...
    'position',[30 95 60 20],...
     'backgroundcolor',[0.75 0.75 0.75],...
    'value',0,...
    'callback',[...
        'grid off,',...
        'set(r2,''value'',1);,',...
        'set(r1,''value'',0)']);
s1=uicontrol('parent',h0,...
    'units','points',...
    'tag','s1',...
    'style','slider',...
    'value',z,...
    'position',[100 95 150 20],...
     'backgroundcolor',[0.75 0.75 0.75],...
    'max',1,...
    'min',0,...
    'callback',[...
        'z=get(s1,''value'');,',...
        'set(t1,''string'',[str1,sprintf(''%1.4g\'',z)]);,',...
        'delete(hline),',...
        'y=step(1,[1 2*z 1],t);,',...
        'hline=plot(t,y);,',...
        'if get(r1,''value'')==1,',...
        'grid on,',...
        'end,',...
        'if get(r2,''value'')==1,',...
        'grid off,',...
        'end']);
t1=uicontrol('parent',h0,...
    'units','points',...
    'tag','t1',...
    'style','text',...
    'string',[str1,sprintf('%1.4g\',z)],...
    'position',[100 120 150 20],...
    'backgroundcolor',[0.75 0.75 0.75]);
b1=uicontrol('parent',h0,...
    'units','points',...
    'tag','b1',...
    'style','pushbutton',...
    'string','关闭',...
    'position',[80 50 80 30],...
    'backgroundcolor',[0.75 0.75 0.75],...
    'fontsize',15,...
    'callback','close');
本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2021-10-24,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 算法工程师的学习日志 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档