Circular motion of a big dog
조회 수: 3 (최근 30일)
이전 댓글 표시
High everybody.
I need to make a dog(a point) run around in a circle with a radius of 1 meter and angular velocity of 1 radian/sec. The time interval is 0-14*pi. The starting position of the dog is (1;0).
Hope somebody can help.
댓글 수: 1
Patrik Ek
2014년 3월 5일
You will need to clarify I guess. I am not really sure what you want to do here. Do you want the dots to be located at the right spot or do you want something that changes in time? If you want somehing that changes in time I guess that a movie could go well here, but if you want to do it with a plot it may be possible to get it to work anyway.
You will need to create a loop that is as short as possible, like the one you already have, to get a low runtime. Then run the function enough times to get a stable average runtime. After that, instead of using pause, which completely halts the matlab execution of the program, use a function that have a stable runtime and set this runtime to the value needed to give the dog the speed 1rad/sec. Functions like this may be found on the internet I guess.
답변 (3개)
Image Analyst
2014년 3월 5일
See the 4th example for circle in the FAQ http://matlab.wikia.com/wiki/FAQ#How_do_I_create_a_circle.3F It's parameterized so basically theta is your time coordinate.
댓글 수: 0
Sebastian
2014년 3월 5일
편집: Sebastian
2014년 3월 5일
댓글 수: 2
Patrik Ek
2014년 3월 5일
This should not be an answer, please place it as an edit to the question. But no great harm done I guess:). Furthermore see my comment on top.
Image Analyst
2014년 3월 5일
Why does it not do anything? Does it ever get called? If you set a breakpoint on the first line, does it stop there? Do you know how to debug?
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!