Using a non-linear value for pause
이전 댓글 표시
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
답변 (3개)
Walter Roberson
2014년 4월 8일
0 개 추천
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
2014년 4월 8일
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
Joseph Cheng
2014년 4월 8일
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?
Abdallah
2014년 4월 8일
카테고리
도움말 센터 및 File Exchange에서 Programming에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!