Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

atan2 of successive point in an Array

조회 수: 1 (최근 30일)
Rica
Rica 2013년 6월 26일
마감: MATLAB Answer Bot 2021년 8월 20일
Hi all!
how could i calculate the atan2 for this Vector in this way:
A=[a0 a1 a2 a3 a4......]
atan_vec=[atan2(a1,a0) atan2(a3,a2) atan2(a4,a3),......]
thank you for the Help

답변 (1개)

Andrei Bobrov
Andrei Bobrov 2013년 6월 26일
편집: Andrei Bobrov 2013년 6월 26일
out = atan2(A(2:end),A(1:end-1));
or
for jj = numel(A)-1:-1:1
out(jj,1) = atan2(A(jj+1),A(jj));
end
or
out = arrayfun(@(ii)atan2(A(ii+1),A(ii)),(1:numel(A)-1)');
or
a = hankel(A(1:end-1),A(end-1:end));
out = atan2(a(:,2),a(:,1));

Community Treasure Hunt

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

Start Hunting!

Translated by