function cloud_generator()
% 创建主窗口
fig = figure('Name', '一维正态云图生成器', ...
'NumberTitle', 'off', ...%%生成的标题不包含图窗编号
'Position', [100, 100, 800, 600], ...%设定图窗位置(默认以屏幕的左下角为原点)和大小
'MenuBar', 'none', ...
'ToolBar', 'none');
% 创建输入控件和标签
createUIControls(fig);
% 创建绘图区域
axes('Parent', fig, 'Position', [0.4, 0.1, 0.55, 0.8]);
end
function createUIControls(fig)
% 参数默认值
defaultEx = '0';
defaultEn = '0.1';
defaultHe = '0.01';
defaultN = '1000';
% 控件位置参数
left = 50;
editWidth = 100;
labelWidth = 100;
height = 20;
verticalSpacing = 30;
top = 500;
% 创建Ex输入
uicontrol('Style', 'text', ...
'Position', [left, top, labelWidth, height], ...
'String', '期望 Ex:');
exEdit = uicontrol('Style', 'edit', ...
'Position', [left+labelWidth, top, editWidth, height], ...
'String', defaultEx, ...
'Tag', 'exEdit');
% 创建En输入
uicontrol('Style', 'text', ...
'Position', [left, top-verticalSpacing, labelWidth, height], ...
'String', '熵 En:');
enEdit = uicontrol('Style', 'edit', ...
'Position', [left+labelWidth, top-verticalSpacing, editWidth, height], ...
'String', defaultEn, ...
'Tag', 'enEdit');
% 创建He输入
uicontrol('Style', 'text', ...
'Position', [left, top-2*verticalSpacing, labelWidth, height], ...
'String', '超熵 He:');
heEdit = uicontrol('Style', 'edit', ...
'Position', [left+labelWidth, top-2*verticalSpacing, editWidth, height], ...
'String', defaultHe, ...
'Tag', 'heEdit');
% 创建n输入
uicontrol('Style', 'text', ...
'Position', [left, top-3*verticalSpacing, labelWidth, height], ...
'String', '云滴数 n:');
n
最新发布