Issue with running Multiple gravity assists code

For an interplanetary mission design involving multiple gravity assists, I have been trying to use the code. It requires to create a structure array and everytime I create and pass it to the function it throws an error saying "Too many input arguments". I am unable to understand how to circumvent the error. I would appreaciate if somebody could show me how to pass the parameters. I have also attached the MATLAB code titled as mga.m. This is my attempt:
t(1)=2000;
t(2)=112;
t(3)=376;
MGAproblem.sequence=[3 2 3];
MGAproblem.DVLaunch=2.98;
MGAproblem.objective.type='Orbit insertion';
MGAproblem.objective.rp=1E+5;
MGAproblem.objective.e=0;
yplot=1;
[J,rp,DVvec,Itime,FBalt,alph,Vrelin,Vrelout] = mga(t,MGAproblem,yplot)

回答 (1 件)

Walter Roberson
Walter Roberson 2018 年 12 月 26 日

0 投票

At one time the code accepted yplot as aa third parameter but that was changed. Now set MGAproblem.yplot = 1

9 件のコメント

Suraj Parasuram
Suraj Parasuram 2018 年 12 月 26 日
It still shows the same error. Too many input arguments.
Walter Roberson
Walter Roberson 2018 年 12 月 26 日
did you also remove the yplot argument from the mga call?
Suraj Parasuram
Suraj Parasuram 2018 年 12 月 26 日
Yes. It is giving a new error:
Reference to non-existent field 'DVlaunch'.
Error in mga (line 73)
DVlaunch = problem.DVlaunch; % launch DV (km/s)
Error in Untitled (line 10)
[J,rp,DVvec,Itime,FBalt,alph,Vrelin,Vrelout] = mga(t,MGAproblem)
Walter Roberson
Walter Roberson 2018 年 12 月 26 日
in your code you assign to DVLaunch with capital L. You need to change it to lowercase L, DVlaunch
Suraj Parasuram
Suraj Parasuram 2018 年 12 月 26 日
Oh oops! But it is giving a new error now:
Reference to non-existent field 'rpmin'.
Error in mga (line 100)
rpmin(2)=problem.rpmin.venus; %(Venus)
Error in Untitled (line 10)
[J,rp,DVvec,Itime,FBalt,alph,Vrelin,Vrelout] = mga(t,MGAproblem)
Walter Roberson
Walter Roberson 2018 年 12 月 26 日
read the comments in the code to see how rpmin and related fields are used.
It looks to me that you will not need customobject fields as you do not have any seq entries greater than 9.
Suraj Parasuram
Suraj Parasuram 2018 年 12 月 26 日
I am not able to understand that link of using rpmin.
Walter Roberson
Walter Roberson 2018 年 12 月 26 日
The code has
%Reading the values for the minimum allowed pericentre radius of each planet
%
rpmin=zeros(6,1);
rpmin(2)=problem.rpmin.venus; %(Venus)
rpmin(3)=problem.rpmin.earth; %(Earth)
rpmin(4)=problem.rpmin.mars; %(Mars)
rpmin(5)=problem.rpmin.jupiter; %(Jupiter)
rpmin(6)=problem.rpmin.saturn; %(Saturn)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Reading the penalty factors for low pericenter fly-bys. These can be
%interpreted as km/sec penalties for each km of violation
%
rpfact=zeros(6,1);
rpfact(2)=problem.rpfact.venus;
rpfact(3)=problem.rpfact.earth;
rpfact(4)=problem.rpfact.mars;
rpfact(5)=problem.rpfact.jupiter;
rpfact(6)=problem.rpfact.saturn;
so this implies that you need to set the fields
MGAproblem.rpmin.venus MGAproblem.rpmin.earth MGAproblem.rpmin.mars MGAproblem.rpmin.jupiter MGAproblem.rpmin.saturn
and
MGAproblem.rpfact.venus MGAproblem.rpfact.earth MGAproblem.rpfact.mars MGAproblem.rpfact.jupiter MGAproblem.rpfact.saturn
Suraj Parasuram
Suraj Parasuram 2018 年 12 月 26 日
Thanks.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeGravitation, Cosmology & Astrophysics についてさらに検索

製品

リリース

R2018a

タグ

質問済み:

2018 年 12 月 25 日

コメント済み:

2018 年 12 月 26 日

Community Treasure Hunt

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

Start Hunting!

Translated by