I have a probably stupid problem but I can't get over it.
The purpose of all this is to have the two variables F_hor_alb and F_ver_alb defined according to the rule reported in the if statement.
If the cosine of that angle (60wt) is greater by an amount in this case equal to -0.37 (shadow) then the two variables must have a sinusoidal trend. Otherwise they are worth zero.
By verifying the outputs of the cosine and of the variables, the first is as it should be, but the variables have all values equal to zero except the first and therefore do not follow the values that the cosine itself assumes. Is there anything in the IF that doesn't work?
(Fhor and Fver are already defined in another piece of the code).
Example of output
Cos(60wt): 0,9980 0,9970 0,9960 .....
F_hor_alb: 0,9980*F_hor 0 0 0 0 0 0 0 0 0 0
F_ver_alb: 0,9980*F_ver 0 0 0 0 0 0 0 0
Re = 6378; % Radius of Earth (km)
z = 500; % Orbital Altitude (km)
mu = 3.986004415e5 % Gravitational constan of Earth (km3/s2)
OrbitalT = 2*pi*sqrt(((Re+z)^3)/mu); % Orbital Period (s)
orbits = 30; % Number of cycles for the simulation
simtime = (OrbitalT*orbits)/60; % Simulation time (min)
simstep = 1; % Sampling step (min)
w=2*pi/OrbitalT;
F_hor_alb = zeros(ceil(simtime));
F_ver_alb = zeros(ceil(simtime));
for t = 1:simstep:ceil(simtime)
if cos(w*t*60)>shadow
F_hor_alb = F_hor*cos(w*t*60);
F_ver_alb = F_ver*cos(w*t*60);
else
F_hor_alb = 0;
F_ver_alb = 0;
end
F_hor_alb(t) = F_hor_alb;
F_ver_alb(t) = F_ver_alb;
coseno(t)=cos(w*t*60);
t=t+1;
end
Aucun commentaire:
Enregistrer un commentaire