this code is meant to prompt user for longitude and latitude values,and find looks angles but it wont run,please help
조회 수: 1 (최근 30일)
이전 댓글 표시
clc
clear all
close all
earth_station_longitude=input('prompt');
earth_station_latitude=input('prompt');
sub_satellite_latitude=input('get longitude');
B=earth_station_longitude-s_s_latitude
b=acosd(cosd(Earth_station_latitude)*cosd(B))
a=42164
R=6371
elevation_angle=acosd((a*sind(b))/range)
range=sqrt(R^2+a^2-2*R*a*cosd(b))
A=asind(sind(abs(B))/sind(b))
if(Earth_station_latitude<0)&&(B<0)
AZ=A
elseif(Earth_station_latitude>0)&&(B<0)
AZ=180-A
elseif(Earth_station_latitude>0)&&(B>0)
AZ=180+A
else
AZ=360-A
end
댓글 수: 1
Walter Roberson
2022년 5월 5일
B=earth_station_longitude-s_s_latitude
s_s_latitude is not defined
b=acosd(cosd(Earth_station_latitude)*cosd(B))
Earth_station_latitude with a capital E is not defined. Variable names are case sensitive.
답변 (1개)
Aashita Dutta
2022년 5월 10일
Hello!
I understand that you are facing issues while running the code, where the user is prompted to enter latitude and longitude values and calculate the angles based on the input arguments.
I have tried to execute the code and found that there are some lexical/syntactical errors in the code, like “s_s_latitude” is undefined and variables name are case sensitive.
Please find the excutable code below:
clc
clear all
close all
earth_station_longitude=input('prompt');
earth_station_latitude=input('prompt');
sub_satellite_latitude=input('get longitude');
B=earth_station_longitude-sub_satellite_latitude
b=acosd(cosd(earth_station_latitude)*cosd(B))
a=42164
R=6371
range=sqrt(R^2+a^2-2*R*a*cosd(b))
elevation_angle=acosd((a*sind(b))/range)
A=asind(sind(abs(B))/sind(b))
if(earth_station_latitude<0)&&(B<0)
AZ=A
elseif(earth_station_latitude>0)&&(B<0)
AZ=180-A
elseif(earth_station_latitude>0)&&(B>0)
AZ=180+A
else
AZ=360-A
end
Thank you
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Reference Applications에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!