manipulate

版本 1.4.0.0 (616.9 KB) 作者: Robert
MATLAB interactive function caller
128.0 次下载
更新时间 2016/7/5

Creates a slider useful for exploring your custom function behavior. Attach your function inputs to sliders using manipulate.m and "play-around" with the values to see your function's response. This is especially useful for interactive plotting.

Help text:

manipulate(@(ARGS)FUNC(ARGS),{LABEL,ARG_MIN,ARG_MAX,[DEFAULT]}...)
calls the function func(ARGS) and allows the user to control the
values of the arguments via sliders. If DEFAULT is not set, the value
is initially set to ARG_MIN.

manipulate expects one cell input per argument. All arguments must be
scalars. Cells can also be of the form{LABEL,VALUES,[DEFAULT]} where
VALUES is a 1D array containing allowed values of the argument.

H = manipulate(...) returns the the slider handles.

manipulate(...,'UpdateMode',MODE) allows the user to set the frequency
with which the function is called.
'Low' Refresh only when slider is released (after drag) or
clicked, or when edit field is altered.
'High' Also refresh continuously as slider is dragged. [Default]
'Manual' Refresh only when user presses button.

manipulate(...,'SliderStep',[SMALL BIG]) allows the user to set the
step size of incremental slider increases and decreases. See UICONTROL
for details.

Examples:
x = 1:.001:10;
gca, L = plot(1,1,1,1);
myfunc = @(i,f,theta)set(L(i),'XData',x,'YData',sin(10*x)+sin(f*x+theta));
h=manipulate(@(f,theta)myfunc(1,f,theta),{'frequency1',10,20},{'phase1',0,2*pi});
manipulate(h,@(f,theta)myfunc(2,f,theta),{'frequency2',10,20},{'phase2',0,2*pi})

Plots the interference of two sine waves and allows the user to
manipulate the frequency and phase offset of the second wave. Then does
the same again, adding the slider controls to the existing slider
figure.

x = linspace(-10,10,1e4);
fig = figure('Visible','off');
ax = [subplot(2,1,1),subplot(2,1,2)];
f1 = @(u,s) plot(ax(1),x,exp(-1/2*((x-u)/s).^2)/sqrt(2*pi)/s,'r');
f2 = @(u,s) title(ax(1),sprintf('N(%.2f,%.2f)',u,s^2));
f3 = @(u,s) plot(ax(2),x,erf((x-u)/s/sqrt(2))/2+1/2,'r');
myfunc = @(u,s) {f1(u,s),f2(u,s),f3(u,s)};
manipulate(fig,myfunc,{'Mean',-5,5,0},{'Standard Deviation',.01,5,1})
linkaxes(ax,'x'), set(ax,'NextPlot','replacechildren')
movegui(fig,'onscreen')
set(fig,'Visible','on')

Plots the normal distribution and its cumuliative distribution on
separate subplots and allows the user to manipulate the mean and
standard deviation. The mean is initially set to 0 and the standard
deviation to 1. The slider controls appear in the same figure as the
subplots.

Created by:
Robert Perrotta

引用格式

Robert (2025). manipulate (https://github.com/raaperrotta/manipulate), GitHub. 检索时间: .

MATLAB 版本兼容性
创建方式 R2013a
兼容任何版本
平台兼容性
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

无法下载基于 GitHub 默认分支的版本

版本 已发布 发行说明
1.4.0.0

Removed github username from submission title.

1.3.0.0

Updated description (again).

1.2.0.0

Updated the description

1.1.0.0

Added an image

1.0.0.0

要查看或报告此来自 GitHub 的附加功能中的问题,请访问其 GitHub 仓库
要查看或报告此来自 GitHub 的附加功能中的问题,请访问其 GitHub 仓库