Looking to animate two lines with the angle between them changing?
이전 댓글 표시
Have an EMG signal which I've used to get a range of corresponding angles. would like to have 2 lines representing an arm where the angle I have is between them. From there i would like to animate the whole process with all angles. Cannot figure out how to do this?
답변 (2개)
Brandon
2014년 11월 25일
0 개 추천
Are you wanting to animate this in real time or create a video file from the plot.
You may be interested in looking at these two functions:
Andrew Reibold
2014년 11월 25일
편집: Andrew Reibold
2014년 11월 25일
Bro, If you are working with EMG signals you should really know how to do Highschool trig... haha :-)
But anyway, here is an example of how you could do it using Unit Circle concepts and a line of length 1! Replace angles with your angles in degrees - This one animates from 30-90. (If your angles are in Radians use sin and cos instead of sind and cosd )
figure
for angles= [30:90];
x = cosd(angles);
y = sind(angles);
plot([0,1],[0,0],[0,x],[0,y])
axis([-1.5 1.5 -1.5 1.5])
pause(.01)
end
댓글 수: 7
Ronan
2014년 11월 25일
Andrew Reibold
2014년 11월 25일
편집: Andrew Reibold
2014년 11월 25일
They can go up or down its fine. They dont have to be in order. There's a way to do anything with the arm. Have an example?
It could go up 30, skip every 5 down 120, then jump to some random number if you wanted to be honest. It can do whatever. Just put the angles in angles as a vector in the order you want them displayed (which is probably whatever you already have them in)
I dont know what you meant be being 'raised instead of dropped'. Do you mean the horizontal line coming up? You could do that.
Ronan
2014년 11월 25일
Ronan
2014년 11월 25일
Andrew Reibold
2014년 11월 25일
25% and 50%... of the time lapse?
Also, this script pauses for .1 seconds for each angle to help see... but if you have 46000 angles thats way too long, you should edit that or else just read in every 100 angles or something if its extremely small changes
Andrew Reibold
2014년 11월 25일
편집: Andrew Reibold
2014년 11월 25일
I think I am misunderstanding what you mean by raised. I am sorry.
On my plot, it already looks like the arm is being 'raised' [from the horizontal - to Vertical]...
Ronan
2014년 11월 25일
카테고리
도움말 센터 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!