this code is meant to prompt user for longitude and latitude values,and find looks angles but it wont run,please help
2 ビュー (過去 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 で Satellite Mission Analysis についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!