Confused about atan versus angle- Not getting the same result!

조회 수: 2 (최근 30일)
Sarah Crimi
Sarah Crimi 2018년 11월 16일
댓글: Sarah Crimi 2018년 11월 19일
Hi,
So I am creating a GUI to show some admittance data. I have the data in two columns real and imaginary by using the angle command. However, when I attempt to check my data, atan does not give me the same result as angle. I can't figure out why. For instance at the peak of one of the plots, I have real= .003453, imag = .001354.
Then, atan((.001354/.003453))=.38, atand((.001354/.003453))=21.4113. BUT angle((.001354/.003453))=0. Why?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Here's the code I used in my GUI.
%This selects the proper plot to plot according to slider value (from 1-220).
handles.admdatatocompare = handles.celldata1{1,handles.slidervar};
guidata(hObject,handles);
admtocompare_full=handles.admdatatocompare(:,2)+(1i.*handles.admdatatocompare(:,3));
admchannel=m1(:,2)+(1i.*m1(:,3));
admphasechannel = angle(admchannel);
admphasetocompare = angle(admtocompare_full);

채택된 답변

Stephan
Stephan 2018년 11월 16일
편집: Stephen23 2018년 11월 16일
Hi,
angle works correctly on complex numbers:
atan((.001354/.003453))
atand((.001354/.003453))
angle((.001354i+.003453))
% This is what you did:
angle(.001354/.003453)+0i
Best regards
Stephan

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 General Applications에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by