MATLAB Answers

"Array indices must be positive integers or logical values." Error Message

조회 수: 1(최근 30일)
Samuel Ross
Samuel Ross 26 Feb 2020
편집: KSSV 26 Feb 2020
%This is my code, and I'm trying to set the individual values of the Rpqw matrix as the formula listed, but I keep getting the error in the title.
close all
clear
clc
%establish COEs
a = 15000;
e = .4;
i = 40;
RA = 20;
w = 200;
v = 350;
mu = 3.986*10^5;
%establish directional vectors
P = [1;0;0];
Q = [0;1;0];
R = [0;0;1];
%Establish cosines and sines of orbital elements
cv = cosd(v);
sv = sind(v);
cRA = cosd(RA);
sRA = sind(RA);
cw = cosd(w);
sw = sind(w);
ci = cosd(i);
si = sind(i);
%Find Rpqw and Vpqw
Rpqw = zeros(3,1);
Rpqw(1) = ((a(1-e^2))/(1+e*cv))*cv;
Rpqw(2) = ((a(1-e^2))/(1+e*cv))*sv;

  댓글 수: 0

로그인 to comment.

답변(1개)

KSSV
KSSV 26 Feb 2020
편집: KSSV 26 Feb 2020
((a(1-e^2)) This is not correct......I think you want
((a*(1-e^2))
close all
clear
clc
%establish COEs
a = 15000;
e = .4;
i = 40;
RA = 20;
w = 200;
v = 350;
mu = 3.986*10^5;
%establish directional vectors
P = [1;0;0];
Q = [0;1;0];
R = [0;0;1];
%Establish cosines and sines of orbital elements
cv = cosd(v);
sv = sind(v);
cRA = cosd(RA);
sRA = sind(RA);
cw = cosd(w);
sw = sind(w);
ci = cosd(i);
si = sind(i);
%Find Rpqw and Vpqw
Rpqw = zeros(3,1);
Rpqw(1) = ((a*(1-e^2))/(1+e*cv))*cv;
Rpqw(2) = ((a*(1-e^2))/(1+e*cv))*sv;

  댓글 수: 0

로그인 to comment.

이 질문에 답변하려면 로그인을(를) 수행하십시오.

태그


Translated by