this code is meant to prompt user for longitude and latitude values,and find looks angles but it wont run,please help
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaire
Walter Roberson
le 5 Mai 2022
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.
Réponses (1)
Aashita Dutta
le 10 Mai 2022
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 commentaires
Voir également
Catégories
En savoir plus sur Satellite Mission Analysis dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!