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 日
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!