Why i am getting wrong value of abcd ?

조회 수: 1 (최근 30일)
Mahesh
Mahesh 2014년 6월 2일
댓글: Star Strider 2014년 6월 2일
I am trying to solve this code. In code inc(1,3)=139 and it give abcd(1,3) for 139 equal to 0.65 whereas when i solve it manually sin(139)=0.81. why i am getting wrong value ? and when i find value of abcd(1,4)=0.8 nearer to 0.81 which should be at abcd(1,3). Please help me solving in this
clear all
clc
Dec=[-23.01, -23.01, -23.01, -23.01, -23.01, -23.01, -23.01, -23.01, -23.01, -23.01];
Omega=[-165, -150, -135, -120, -105, -90, -75, -60, -45, -30];
phi=33.7;
for t=1:10;
phi=33.6;
angle1(1,t)=cosd(phi)*cosd(Dec(1,t))*cosd(Omega(1,t));
angle2(1,t)=sind(phi)*sind(Dec(1,t));
inc(1,t)=acosd(angle1(1,t)+angle2(1,t));
% re(1,t)=asind(sind(inc(1,t))/1.33); % Reflection angle is found by assumed incident angle
abcd(1,t)=sind(inc(1,t));
end

답변 (2개)

Star Strider
Star Strider 2014년 6월 2일
편집: Star Strider 2014년 6월 2일
If you want the sin() with a radian argument, change your statement to:
abcd(1,t)=sin(inc(1,t));
However all of your angle calculations otherwise are in degrees, not radians, so this will likely not give you the correct answer.
  댓글 수: 2
Mahesh
Mahesh 2014년 6월 2일
I want to measure in degree that why i have write sind.
why i am getting wrong answer in this?
Star Strider
Star Strider 2014년 6월 2일
You are using ‘grad’ angle units in your hand calculator calculations, not degrees:
sin(139 degs) = 0.65605902899050728478249596402342
sin(139 grad) = 0.81814971742502343212965828088413
(These from Windows Calculator.)
In MATLAB:
abcd_deg = sind(139)
abcd_rad = sin(139)
abcd_grd = sin(139*(pi/200))
produces:
abcd_deg =
656.0590e-003
abcd_rad =
696.0801e-003
abcd_grd =
818.1497e-003

댓글을 달려면 로그인하십시오.


Roger Wohlwend
Roger Wohlwend 2014년 6월 2일
You don't get the wrong values. sin(139) = 0.81, that is right, but that is not what your code calculates. It calculates sind(139) and that is 0.65.
  댓글 수: 1
Mahesh
Mahesh 2014년 6월 2일
Yes i know, thats why i am asking how to correct this ?

댓글을 달려면 로그인하십시오.

카테고리

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

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by