I created a simple live script where sliders are used to select two parameters, and then a step response is plotted, which depends on the two parameters. Here is my simple code
wn = 2;
zeta = 0.2;
s = tf('s');
The plot is sluggish to update as I move the sliders, and I want it to be more responsive. I used the "Run on: Value changing" option, but there is still a visible lag. I think the bottleneck is due to the figure being re-drawn every time I change the parameters. Is it possible for the live script to modify an existing figure every time a slider is changed? This might involve having one chunk of code that is only run once per section (e.g. create base figure, axes, labels, initial plot) and then every time the slider is moved, only certain components of the plot are modified, thus speeding up rendering.
If it turns out that "step" is actually the bottleneck here, then I'm open to other suggestions --- e.g. pre-computing all the step responses for all possible parameter values and not doing any live computations. I don't really care how long it takes to pre-compute or pre-compile, I just want the end product to be a truly interactive (and instantly updating) figure.