I wrote a script with a function
ex: function [DV] = deltaV(debris1, debris2, t1,t2,t1_0,t2_0,rE,mu,J2)
I have to plot the function with an increasing t2 or an increasing debris2(3) (debris1 and debris2 are vectors)
how can I do that?

 採用された回答

Jan
Jan 2021 年 6 月 26 日

0 投票

t2 = linspace(0, 10, 100);
DV = zeros(size(t2));
for k = 1:numel(t2)
DV(k) = deltaV(debris1, debris2, t1, t2(k), t1_0, t2_0, rE, mu, J2);
end
plot(t2, DV);

2 件のコメント

Giorgia Di Dio
Giorgia Di Dio 2021 年 6 月 26 日
Thank you
It works for t2 even though I have to use it for small numbers, but I can't make it work for debris2(3).
Do I have to use it in the same way even if debris2 is a vector?
Jan
Jan 2021 年 6 月 28 日
debris2 = rand(1, 3);
DV = zeros(1, 100);
for k = 1:100
debris2(3) = rand;
DV(k) = deltaV(debris1, debris2, t1, t2, t1_0, t2_0, rE, mu, J2);
end

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeLoops and Conditional Statements についてさらに検索

質問済み:

2021 年 6 月 26 日

コメント済み:

Jan
2021 年 6 月 28 日

Community Treasure Hunt

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

Start Hunting!

Translated by