File Exchange

image thumbnail

tweak

version 1.0.0.0 (40.4 KB) by Misha Dabaghyan
allows to visually tweak parameters of a given function

0 Downloads

Updated 11 Oct 2017

View License

tweak helps visually evaluate the effect of changing or tweaking a parameter in an expression containing a function which can produce a 2D plot. It then creates a slider for each parameter that needs tweaking. E.g. 'a*sin(b*x+c); would be the first argument, and its parameters ('a', 'b' or 'c') the second. An adjustment range for a given parameter can be specified as the third argument.
Examples
x = linspace(0,1,1000); a = 2; b = 10; c = 100;
tweak('a*sin(x*b+c)', 'b') ;
tweak('a*sin(x*b+c)', 'a', [0.1, 2]);
Here, the the first invocation of tweak will allow the adjustment of b by +/- 0.5*b around it's value by opening a plot of the expression and creating a slider for the parameter 'b' that allows values from 5 to 15 (i.e. 10 +/- 5) and from 0.1 to 2 for 'a' respectively. Note, that if the plot remains open after the first tweak, a second slider (for 'a') will be simply added to the figure, so that the two parameters can be tweaked interchangeably.
The values of the parameters in the main workspace will be set by the final positions of the corresponding sliders.

Comments and Ratings (1)

Another example:

z = besselj(6, linspace(-100, 100, 1000)); % some curve
z = z + rand(size(z)); % add noise
plot(z); hold all
wind = 4; % initial guess for the smoothing window
tweak('smooth(z, round(wind))', 'wind', [2 20]); % vary window between 2 and 20
legend('before', 'after');

Updates

1.0.0.0

included findjobj.m

MATLAB Release Compatibility
Created with R2017a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Discover Live Editor

Create scripts with code, output, and formatted text in a single executable document.


Learn About Live Editor