admin管理员组文章数量:1655503
function basicSTK
% basicSTK - basic STK scenario demo
%
% USAGE basicSTK
%
% This MATLAB Mfile will demonstrate the creation/parsing of a report
% and the optimization of facilty placement based on access duration
%
% This is a contributed program. AGI (Analytical Graphics Inc.) assumes no responsibility % whatsoever for the results obtained from, or any damage caused by the use of this % program.
remMachine = stkDefaultHost;
%清除matlab中打开的任何图形
delete(get(0,'children'));
%
% 打开与STK的连接
%
conid=stkOpen(remMachine);
dtr = pi/180;
rtd = 180/pi;
% stkValidScen命令作用,如果stk中已经存在场景,则返回1,否则为0 scen_open = stkValidScen;
if scen_open == 1
rtn = questdlg('Close the current scenario?');
% questdlg是GUI中的问题对话框命令,默认答案是 ‘yes’、’no’和’cancel’ if ~strcmp(rtn,'Yes')
% strcmp是比较两个字符串的命令,如果相同则返回1,否则返回0
stkClose(conid) %如果选no的话,关闭与stk的通信
return
else
stkUnload('/*') %选yes的情况,卸载stk中当前存在的场景
end
end
%建立一个新场景
disp('Create a new scenario');
%stk中建立一个场景的格式stkNewObj('parentPath', 'class', 'name')
stkNewObj('/','Scenario','Matlab_Basic');
% 设置场景周期stkSetTimePeriod('start', 'stop', 'dateFormat')
disp('Set scenario time period');
stkSetTimePeriod('1 May 2000 00:00:00.0','2 May 2000 00:00:00.0','GREGUTC');
stkSetEpoch('1 May 2000 00:00:00.0','GREGUTC');
stkSyncEpoch;
% stkConnect 发送例行的连接命令到stk中
% rtnData = stkConnect(conID, 'command', 'objPath', 'cmdParamString')
rtn = stkConnect(conid,'Animate','Scenario/Matlab_Basic','SetValues "1 May 2000 00:00:00.0" 60 0.1'); rtn = stkConnect(conid,'Animate','Scenario/Matlab_Basic','Reset');
%建立新的地面站
disp('Create a new facility');
stkNewObj('*/','Facility','Test_Facility');
%建立新的卫星
disp('Create a new satellite');
stkNewObj('*/','Satellite','Basic_Sat');
% set up the propagator for the satellite
disp('Set up the propagator for the satellite');
inc = 60*dtr;
raan = 132.881811*dtr;
% stkSetPropClassical 设置propagator的参数,在传统的坐标系中
% stkSetPropClassical('objPath', 'propagator', 'coordSystem', ...
% tStart, tStop, dt, orbitEpoch, semimajorAxis, eccentricity,...
% inclination, argOfPerigee, RAAN, meanAnomaly, coordEpoch)
%目标路径的说明*/Satellite/Basic_Sat,*/Satellite/是类别Basic_Sat是名字
stkSetPropClassical('*/Satellite/Basic_Sat','J4Perturbation','J2000',0.0,86400.0,60.0,0,9059000.608735,0.0,inc,0.0,raan,0.0);
% set up loop to move facility within a 50x40 grid to determine optimum placement
disp('Set up loop to move facility within a 50x40 grid over the continental US to determine optimum placement'); disp('Facility will now be moved to various locations, and access data will be processed');
disp('Watch the 2D Map window as the access graph
版权声明:本文标题:matlab stk 代码,stk-matlab 交互连接实例(含代码) 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/dongtai/1729699643a1210453.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论