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
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
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

类别

Help CenterFile Exchange 中查找有关 Satellite Mission Analysis 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by