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

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?
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 Exchange에서 Loops 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