"Array indices must be positive integers or logical values." Error Message
Show older comments
%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;
Answers (1)
((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;
Categories
Find more on Prepare Model Inputs and Outputs in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!