设为首页收藏本站

EPS数据狗论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 1370|回复: 0

Matlab程序:手画光滑曲线图形界面

[复制链接]

4

主题

64

金钱

84

积分

新手用户

发表于 2018-9-14 08:56:19 | 显示全部楼层 |阅读模式
  1. function fig = draw()
  2. % 手画光滑曲线图形界面
  3. % 先用Range确定大致范围;然后用ginput用鼠标单击大致数据点;最后用Draw it画图。
  4. % 本程序采用样条拟合

  5. % By L. J. Hu, 2000
  6. % This is the machine-generated representation of a Handle Graphics object
  7. % and its children.  Note that handle values may change when these objects
  8. % are re-created. This may cause problems with any callbacks written to
  9. % depend on the value of the handle at the time the object was saved.
  10. %
  11. % To reopen this object, just type the name of the M-file at the MATLAB
  12. % prompt. The M-file and its associated MAT-file must be on your path.

  13. load draw

  14. h0 = figure('Color',[0.8 0.8 0.8], ...
  15.         'Colormap',mat0, ...
  16.         'Name','Smooth Draw', ...
  17.         'NumberTitle','off', ...
  18.         'PointerShapeCData',mat1, ...
  19.         'Position',[40 45 560 375], ...
  20.         'Resize','off', ...
  21.         'Tag','drawfig', ...
  22.         'UserData',mat2);
  23. h1 = axes('Parent',h0, ...
  24.         'Units','pixels', ...
  25.         'Box','on', ...
  26.         'CameraUpVector',[0 1 0], ...
  27.         'CameraUpVectorMode','manual', ...
  28.         'Color',[1 1 1], ...
  29.         'ColorOrder',mat3, ...
  30.         'HandleVisibility','callback', ...
  31.         'Position',[52 135 347 218], ...
  32.         'Tag','Axes1', ...
  33.         'XColor',[0 0 0], ...
  34.         'XGrid','on', ...
  35.         'XLimMode','manual', ...
  36.         'YColor',[0 0 0], ...
  37.         'YGrid','on', ...
  38.         'YLimMode','manual', ...
  39.         'ZColor',[0 0 0], ...
  40.         'ZGrid','on');
  41. h2 = text('Parent',h1, ...
  42.         'Color',[0 0 0], ...
  43.         'HandleVisibility','off', ...
  44.         'HorizontalAlignment','center', ...
  45.         'Position',[0.4971098265895954 -0.1105990783410138 9.160254037844386], ...
  46.         'Tag','Axes1Text4', ...
  47.         'VerticalAlignment','cap');
  48. set(get(h2,'Parent'),'XLabel',h2);
  49. h2 = text('Parent',h1, ...
  50.         'Color',[0 0 0], ...
  51.         'HandleVisibility','off', ...
  52.         'HorizontalAlignment','center', ...
  53.         'Position',[-0.08959537572254335 0.4930875576036867 9.160254037844386], ...
  54.         'Rotation',90, ...
  55.         'Tag','Axes1Text3', ...
  56.         'VerticalAlignment','baseline');
  57. set(get(h2,'Parent'),'YLabel',h2);
  58. h2 = text('Parent',h1, ...
  59.         'Color',[0 0 0], ...
  60.         'HandleVisibility','off', ...
  61.         'HorizontalAlignment','right', ...
  62.         'Position',[-0.1502890173410405 1.101382488479263 9.160254037844386], ...
  63.         'Tag','Axes1Text2', ...
  64.         'Visible','off');
  65. set(get(h2,'Parent'),'ZLabel',h2);
  66. h2 = text('Parent',h1, ...
  67.         'Color',[0 0 0], ...
  68.         'HandleVisibility','off', ...
  69.         'HorizontalAlignment','center', ...
  70.         'Position',[0.4971098265895954 1.032258064516129 9.160254037844386], ...
  71.         'Tag','Axes1Text1', ...
  72.         'VerticalAlignment','bottom');
  73. set(get(h2,'Parent'),'Title',h2);
  74. h1 = uicontrol('Parent',h0, ...
  75.         'Units','points', ...
  76.         'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ...
  77.         'ListboxTop',0, ...
  78.         'Position',[325.5 3 85.5 263.25], ...
  79.         'Style','frame', ...
  80.         'Tag','Frame1');
  81. h1 = uicontrol('Parent',h0, ...
  82.         'Units','points', ...
  83.         'Callback','clear;[x,y]=ginput;', ...
  84.         'FontSize',14, ...
  85.         'ListboxTop',0, ...
  86.         'Position',[333 222 72 25.5], ...
  87.         'String','Ginput', ...
  88.         'Tag','Pushbutton1');
  89. h1 = uicontrol('Parent',h0, ...
  90.         'Units','points', ...
  91.         'Callback','pp=csaps(x,y,0.9999);fnplt(pp,''b'',2);', ...
  92.         'FontSize',14, ...
  93.         'ListboxTop',0, ...
  94.         'Position',[333.75 192 72 24.75], ...
  95.         'String','Draw It', ...
  96.         'Tag','Pushbutton2');
  97. h1 = uicontrol('Parent',h0, ...
  98.         'Units','points', ...
  99.         'Callback','gline', ...
  100.         'FontSize',14, ...
  101.         'ListboxTop',0, ...
  102.         'Position',[333.75 163.5 72 24.75], ...
  103.         'String','Line', ...
  104.         'Tag','Pushbutton3');
  105. h1 = uicontrol('Parent',h0, ...
  106.         'Units','points', ...
  107.         'Callback',mat4, ...
  108.         'FontSize',14, ...
  109.         'ListboxTop',0, ...
  110.         'Position',[334.5 102 72 25.5], ...
  111.         'String','Range', ...
  112.         'Tag','Pushbutton4');
  113. h1 = uicontrol('Parent',h0, ...
  114.         'Units','points', ...
  115.         'Callback','cla;axis([0 1 0 1]);hold off', ...
  116.         'FontSize',14, ...
  117.         'ListboxTop',0, ...
  118.         'Position',[334.5 13.5 71.25 26.25], ...
  119.         'String','Erase', ...
  120.         'Tag','Pushbutton5');
  121. h1 = uicontrol('Parent',h0, ...
  122.         'Units','points', ...
  123.         'Callback','grid', ...
  124.         'FontSize',14, ...
  125.         'ListboxTop',0, ...
  126.         'Position',[334.5 133.5 72 25.5], ...
  127.         'String','Grid', ...
  128.         'Tag','Pushbutton6');
  129. h1 = uicontrol('Parent',h0, ...
  130.         'Units','points', ...
  131.         'ListboxTop',0, ...
  132.         'Position',[21.75 9 273 63.75], ...
  133.         'Style','frame', ...
  134.         'Tag','Frame2');
  135. h1 = uicontrol('Parent',h0, ...
  136.         'Units','points', ...
  137.         'BackgroundColor',[1 1 1], ...
  138.         'Callback','eval(get(gcbo,''string''))', ...
  139.         'ListboxTop',0, ...
  140.         'Position',[32.25 9.75 261 46.5], ...
  141.         'Style','edit', ...
  142.         'Tag','EditText1');
  143. h1 = uicontrol('Parent',h0, ...
  144.         'Units','points', ...
  145.         'Callback',mat5, ...
  146.         'FontSize',14, ...
  147.         'ListboxTop',0, ...
  148.         'Position',[334.5 73.5 71.25 23.25], ...
  149.         'String','Labels', ...
  150.         'Tag','Pushbutton7');
  151. h1 = uicontrol('Parent',h0, ...
  152.         'Units','points', ...
  153.         'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ...
  154.         'ListboxTop',0, ...
  155.         'Position',[27 57.75 81 12], ...
  156.         'String','Command Window', ...
  157.         'Style','text', ...
  158.         'Tag','StaticText1');
  159. h1 = uicontrol('Parent',h0, ...
  160.         'Units','points', ...
  161.         'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ...
  162.         'ListboxTop',0, ...
  163.         'Position',[332.25 248.25 75.75 15], ...
  164.         'String','Control Panel', ...
  165.         'Style','text', ...
  166.         'Tag','StaticText2');
  167. h1 = uicontrol('Parent',h0, ...
  168.         'Units','points', ...
  169.         'Callback','hold', ...
  170.         'FontSize',14, ...
  171.         'ListboxTop',0, ...
  172.         'Position',[334.5 43.5 70.5 24.75], ...
  173.         'String','Hold', ...
  174.         'Tag','Pushbutton8');
  175. if nargout > 0, fig = h0; end
复制代码


您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

站长推荐上一条 /1 下一条

客服中心
关闭
在线时间:
周一~周五
8:30-17:30
QQ群:
653541906
联系电话:
010-85786021-8017
在线咨询
客服中心

意见反馈|网站地图|手机版|小黑屋|EPS数据狗论坛 ( 京ICP备09019565号-3 )   

Powered by BFIT! X3.4

© 2008-2028 BFIT Inc.

快速回复 返回顶部 返回列表