Solar flux variation over Earth orbit.

Model the Earth orbit around the sun for a year and call SolarFlx, to demonstrate the variation in solar flux, which is nearly 100 W/m2. The reported flux is the flux above the atmosphere.

The same scaling law is used by TerrestrialSolarFlux, which also returns the sun unit vector in the Earth-centered (ECI) frame, but using the Almanac function SunV1 to compute the sun vector instead of PlanetPosition. The results are therefore slightly different. ------------------------------------------------------------------------- See also SolarFlx, PlanetPosition, Constant, Plot2D, Date2JD, Mag, TerrestrialSolarFlux -------------------------------------------------------------------------

%--------------------------------------------------------------------------
%	 Copyright (c) 2015 Princeton Satellite Systems, Inc.
%  All rights reserved.
%--------------------------------------------------------------------------
%  Since 2016.1
%--------------------------------------------------------------------------

% Get today's date
jD0 = Date2JD;

% Make an array of dates
days = 0:1:365;
jD = jD0 + days;

% Earth's location over one year
PlanetPosition( 'initialize', 3 )
r = PlanetPosition( 'update', jD );

% Scale into astronomical units
au = Constant('au');
rMag = Mag(r)/au;

% Calculate the solar flux accounting for this distance
flux = SolarFlx( rMag );

% Plot
tStr = ['Days from ' datestr(JD2Date(jD0),1)];
Plot2D(days,flux,tStr,'Flux (W/m2)','Solar Flux Variation over Year using PlanetPosition')

% TerrestrialSolarFlux built-in demo for comparison.
% In this case the year is modeled from J2000.
TerrestrialSolarFlux
xlabel(['Days from ' datestr(JD2Date(JD2000),1)])


%--------------------------------------
TerrestrialSolarFlux demo from J2000