QQ登录

只需要一步,快速开始

 注册地址  找回密码
查看: 688|回复: 0
打印 上一主题 下一主题

【奠基经典】MATLAB实用程序案例之绘制不同函数曲线的用户界面

[复制链接]
字体大小: 正常 放大

398

主题

13

听众

1339

积分

  • TA的每日心情
    慵懒
    2015-12-12 14:33
  • 签到天数: 81 天

    [LV.6]常住居民II

    跳转到指定楼层
    1#
    发表于 2015-7-29 23:54 |只看该作者 |倒序浏览
    |招呼Ta 关注Ta







    绘制不同函数曲线的用户界面
    实例:

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

    'position',[198 56 408 468],...

    'name','实例50');

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

    'position',[0.29 0.45 0.7 0.5],...

    'visible','on');

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

    'style','frame',...

    'position',[5 50 90 400]);

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

    'style','pushbutton',...

    'position',[150 100 60 40],...

    'string','绘图',...

    'callback',[...

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

    'n=str2num(get(e2,''string''));,',...

    'a=get(l1,''value'');,',...

    'x=m:0.1:n;',...

    'if a==1,',...

    'plot(x,sin(x)),',...

    'end,',...

    'if a==2,',...

    'plot(x,cos(x)),',...

    'end,',...

    'if a==3,',...

    'plot(x,exp(x)),',...

    'end']);

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

    'style','pushbutton',...

    'position',[270 100 60 40],...

    'string','关闭',...

    'callback','close');

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

    'style','listbox',...

    'position',[10 300 80 80],...

    'string','sin(x)|cos(x)|exp(x)',...

    'value',1,...

    'max',0.5,...

    'min',0);

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

    'style','text',...

    'string','选择函数',...

    'fontsize',10,...

    'position',[10 380 80 20]);

    r1=uicontrol('style','radio',...

    'string','grid on',...

    'value',0,...

    'position',[10 100 60 20],...

    'callback',[...

    'grid on,',...

    'set(r1,''value'',1);,',...

    'set(r2,''value'',0)']);

    r2=uicontrol('style','radio',...

    'string','grid off',...

    'position',[10 80 60 20],...

    'value',1,...

    'callback',[...

    'grid off,',...

    'set(r2,''value'',1);,',...

    'set(r1,''value'',0)']);

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

    'style','edit',...

    'string',0,...

    'position',[20 210 60 20],...

    'horizontalalignment','right');

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

    'style','edit',...

    'string','3',...

    'position',[20 150 60 20],...

    'horizontalalignment','right');

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

    'style','text',...

    'string','X from',...

    'fontsize',10,...

    'position',[20 230 60 20],...

    'horizontalalignment','center');

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

    'style','text',...

    'string','To',...

    'fontsize',10,...

    'position',[20 170 60 20],...

    'horizontalalignment','center');



    关于本帖内容欢迎大家踊跃讨论,与在下交流!

    zan
    转播转播0 分享淘帖0 分享分享0 收藏收藏0 支持支持0 反对反对0 微信微信
    您需要登录后才可以回帖 登录 | 注册地址

    qq
    收缩
    • 电话咨询

    • 04714969085
    fastpost

    关于我们| 联系我们| 诚征英才| 对外合作| 产品服务| QQ

    手机版|Archiver| |繁體中文 手机客户端  

    蒙公网安备 15010502000194号

    Powered by Discuz! X2.5   © 2001-2013 数学建模网-数学中国 ( 蒙ICP备14002410号-3 蒙BBS备-0002号 )     论坛法律顾问:王兆丰

    GMT+8, 2025-5-21 13:52 , Processed in 0.578244 second(s), 53 queries .

    回顶部