stk8和matlab连接步骤,stk-matlab 交互连接实例(含代码)

一个stk-matlab 互联的例子,包含代码,供大家学习

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值