clear all; format long g; format compact fclose('all'); fid = fopen('C:\Repos\doc\SystemDocs\SPAD\GMAT_scripts\OneHalfDeg_500m2_flat_plate.spo','w'); formatSpec = ' %20.14f %20.14f %20.14f %20.14f %20.14f\n'; Area = 500; Step = 0.5; az_index = [-180.0:Step:180.0]; el_index = [-90.0:Step:90.0]; m = size(az_index,2); n = size(el_index,2); m*n formatSpec_header = ' %s\n'; cd 'C:\Repos\doc\SystemDocs\SPAD\GMAT_scripts' str=... {'Version : 4.21' 'System : sphericalSat' 'Analysis Type : Area' 'Pixel Size : 5' 'Spacecraft Size : 436.2' 'Pressure : 1' 'Center of Mass : (50.9, 184.9, -49)' 'Current time : May 7, 2009 15:53:38.00' ' ' 'Motion : 1' ' Name : Azimuth' ' Method : Step' ' Minimum : -180' ' Maximum : 180' ' Step : 0.5' 'Motion : 2' ' Name : Elevation' ' Method : Step' ' Minimum : -90' ' Maximum : 90' ' Step : 0.5' ': END' ' ' 'Record count : 260281' ' ' ' AzimuthElevatio Force(X) Force(Y) Force(Z) ' ' degrees degrees m^2 m^2 m^2 ' ' ------- ------- --------- --------- --------- --------- '}; for i = 1:size(str,1) fprintf( fid,formatSpec_header,str{i} ); end for az = az_index for el = el_index % az1 = az + 180; az1=az; Unit = [cosd(az1)*cosd(el), sind(az1)*cosd(el), sind(el)]; Cos_SC2Sun_vs_SA_normal = dot(Unit, [1, 0, 0]); if Cos_SC2Sun_vs_SA_normal > cosd(.01) x = -Area*Unit; else x = [0,0,0]; end fprintf(fid,formatSpec,az, el, x(1), x(2), x(3) ); end end str2 = ... {' ' ' ------- ------- --------- --------- --------- --------- ----------- ----------- ----------- --------- -----------'}; for i = 1:size(str2,1) fprintf( fid,formatSpec_header,str2{i} ); end