"Array indices must be positive integers or logical values." Error Message
Afficher commentaires plus anciens
%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;
Réponses (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;
Catégories
En savoir plus sur Prepare Model Inputs and Outputs dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!