Using a non-linear value for pause
1 view (last 30 days)
Show older comments
I am trying to set a certain object to rotate, but the rotation is meant to be decaying with time. So I assume I will need an exponential function, that I can use in the pause command to do this. However I seem to still get linear rotation, even though my pause function is set to be exponential. Here is my code:
%%%%%I just posted the related part of the code
for trib=1:1:length(ang); %%%ang was used before
for ang=-0.1366*pi:.02:1.1366*pi;
xx=log(4-ang/4).*-10.96;
%%%%figure setting
%%%%plotting command
pause(xx);
end
end
0 Comments
Answers (3)
Walter Roberson
on 8 Apr 2014
Your x values are all negative. ang would have to be at least 3.819718633 * pi in order for (4-ang/4) to be as low as 1 and thus generate a negative log() to multiply by the negative 10.96 in order to generate a positive pause time.
Joseph Cheng
on 8 Apr 2014
Try exaggerating the the non-linearity and see if you see a bigger difference.
you can see how things are performing if you insert some debugging code
for ang=-0.1366*pi:.02:1.1366*pi;
tic,
xx=log((4-ang)/4).*-10.96;
pause(xx)
disp([toc xx]);
end
the displayed toc should be close to your xx value.
2 Comments
Joseph Cheng
on 8 Apr 2014
wouldn't it also be more practical to add a term to the angular rotation equation to vary the angular rotation over time rather than keeping the angular rotation constant but stretching time?
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!