フィルターのクリア

How can I apply the attached vector coding equation to a matrix in matlab?

3 ビュー (過去 30 日間)
Kylie Davis
Kylie Davis 2016 年 5 月 25 日
コメント済み: Star Strider 2016 年 5 月 27 日
I currently am using atan2d(y,x) but I am unsure whether that is accounting for the y(i+1)-y(i) and x(i+1)-x(i) nature of the equation. x and y are defined as the two matrices I am comparing (i.e. knee versus ankle joint angles during a gait cycle).

採用された回答

Star Strider
Star Strider 2016 年 5 月 25 日
It won’t account for it unless you tell it to:
Theta_vc = atan2d(diff(theta1), diff(theta2));
NOTE This should work with your data.
  5 件のコメント
Kylie Davis
Kylie Davis 2016 年 5 月 27 日
To be more specific... X is the ankle angle over a gait cycle, and y is the knee angle over a gait cycle. The vector coding phase angle I want is equal to tan-1(y(i+1)-y(i),x(i+1)-x(i)) for each consecutive data point (which is 101 points because data was normalized to 100% gait cycle).
Star Strider
Star Strider 2016 年 5 月 27 日
My code:
Theta_vc = atan2d(diff(theta1), diff(theta2));
does exactly what the expression in your image does. See the documentation on the diff function for details.
If you just have vectors, they will work with my code whether they’re row or column vectors. I don’t understand your gait cycle coding (an area peripheral to my areas of expertise). I would use atan2 or atan2d because they reflect the correct quadrants.
If you want to convert the angles you get as Theta_vc to 0°-360° or 0-2*pi, use the appropriate one of these functions:
Angles360 = @(a) rem(360+a, 360); % For ‘atan2d’
Angles2pi = @(a) rem(2*pi+a, 2*pi); % For ‘atan2’

サインインしてコメントする。

その他の回答 (1 件)

James Tursa
James Tursa 2016 年 5 月 25 日
編集済み: James Tursa 2016 年 5 月 25 日
atan2d(y,x) will not do any difference calculations such as y(i+1)-y(i) or x(i+1)-x(i) as part of the calculation. So you would need to do that calculation before using atan2d (e.g. using the diff function). Are x and y 1D vectors or 2D matrices?
  1 件のコメント
Kylie Davis
Kylie Davis 2016 年 5 月 26 日
I believe it is 2D matrices. I am new to Matlab and am sorry if I'm asking a basic question. I appreciate your feedback thank you!

サインインしてコメントする。

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by