Why i am getting wrong value of abcd ?

3 次查看(过去 30 天)
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.

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

标签

尚未输入任何标签。

Community Treasure Hunt

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

Start Hunting!

Translated by