Why i am getting wrong value of abcd ?

1 Ansicht (letzte 30 Tage)
Mahesh
Mahesh am 2 Jun. 2014
Kommentiert: Star Strider am 2 Jun. 2014
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

Antworten (2)

Star Strider
Star Strider am 2 Jun. 2014
Bearbeitet: Star Strider am 2 Jun. 2014
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 Kommentare
Mahesh
Mahesh am 2 Jun. 2014
I want to measure in degree that why i have write sind.
why i am getting wrong answer in this?
Star Strider
Star Strider am 2 Jun. 2014
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

Melden Sie sich an, um zu kommentieren.


Roger Wohlwend
Roger Wohlwend am 2 Jun. 2014
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 Kommentar
Mahesh
Mahesh am 2 Jun. 2014
Yes i know, thats why i am asking how to correct this ?

Melden Sie sich an, um zu kommentieren.

Tags

Noch keine Tags eingegeben.

Community Treasure Hunt

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

Start Hunting!

Translated by