Data Analysis

15
DATA ANALYSIS USING MATLAB Our online Tutors are available 24*7 to provide Help with Data Analysis Homework/Assignment or a long term Graduate/Undergraduate Data Analysis Project. Our Tutors being experienced and proficient in Data Analysis ensure to provide high quality Data Analysis Homework Help. Upload your Data Analysis Assignment at ‘Submit Your Assignment’ button or email it to [email protected] . You can use our ‘Live Chat’ option to schedule an Online Tutoring session with our Data Analysis Tutors. INTERPLANETARY PORK CHOP PLOTS This sample assignment shows a MATLAB Script for Creating Pork Chop Plots of Ballistic Earth-to-Mars Trajectories jplephem (et, ntarg, ncent) function rrd = jplephem (et, ntarg, ncent) % reads the jpl planetary ephemeris and gives % the position and velocity of the point 'ntarg' % with respect to point 'ncent' % input % et = julian ephemeris date at which interpolation is wanted % ntarg = integer number of 'target' point % ncent = integer number of center point % the numbering convention for 'ntarg' and 'ncent' is: % 1 = mercury 8 = neptune % 2 = venus 9 = pluto % 3 = earth 10 = moon % 4 = mars 11 = sun % 5 = jupiter 12 = solar-system barycenter % 6 = saturn 13 = earth-moon barycenter % 7 = uranus 14 = nutations (longitude and obliq) % 15 = librations, if on ephemeris file % if nutations are wanted, set ntarg = 14. % for librations, set ntarg = 15. set ncent = 0. % output

description

 

Transcript of Data Analysis

  • 1. DATA ANALYSIS USING MATLAB Our online Tutors are available 24*7 to provide Help with Data Analysis Homework/Assignment or a long term Graduate/Undergraduate Data Analysis Project. Our Tutors being experienced and proficient in Data Analysis ensure to provide high quality Data Analysis Homework Help. Upload your Data Analysis Assignment at Submit Your Assignment button or email it to [email protected]. You can use our Live Chat option to schedule an Online Tutoring session with our Data Analysis Tutors. INTERPLANETARY PORK CHOP PLOTS This sample assignment shows a MATLAB Script for Creating Pork Chop Plots of Ballistic Earth-to-Mars Trajectories jplephem (et, ntarg, ncent) function rrd = jplephem (et, ntarg, ncent) % reads the jpl planetary ephemeris and gives % the position and velocity of the point 'ntarg' % with respect to point 'ncent' % input % et = julian ephemeris date at which interpolation is wanted % ntarg = integer number of 'target' point % ncent = integer number of center point % the numbering convention for 'ntarg' and 'ncent' is: % 1 = mercury 8 = neptune % 2 = venus 9 = pluto % 3 = earth 10 = moon % 4 = mars 11 = sun % 5 = jupiter 12 = solar-system barycenter % 6 = saturn 13 = earth-moon barycenter % 7 = uranus 14 = nutations (longitude and obliq) % 15 = librations, if on ephemeris file % if nutations are wanted, set ntarg = 14. % for librations, set ntarg = 15. set ncent = 0. % output

2. % rrd = output 6-word array containing position and velocity % of point 'ntarg' relative to 'ncent'. the units are au and % au/day. for librations the units are radians and radians % per day. in the case of nutations the first four words of % rrd will be set to nutations and rates, having units of % radians and radians/day. % the option is available to have the units in km and km/sec. % for this, set km = 1 via global in the calling program. % Orbital Mechanics with Matlab %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% global cval ss au emrat ncon ipt np nv twot pc vc global iephem ephname bary pvsun nrl fid lpt rrd = zeros(6, 1); list = zeros(12, 1); et2 = zeros(2, 1); % load time array et2(1) = et; et2(2) = 0; % first entry? if (iephem == 1) pvsun = zeros(6, 1); % read header file data fid = fopen(ephname, 'r'); ttl = fread(fid, 252); cnam = fread(fid, 2400); ss = fread(fid, 3, 'double'); ncon = fread(fid, 1, 'int'); % astronomical unit 3. au = fread(fid, 1, 'double'); % earth-moon ratio emrat = fread(fid, 1, 'double'); ipt = fread(fid, [3 12], 'int'); numde = fread(fid, 1, 'int'); lpt = fread(fid, 3, 'int'); % move to next record status = fseek(fid, 8144, 'bof'); % read "constant" values cval = fread(fid, 400, 'double'); % initialization nrl = 0; bary = 0; pc(1) = 1; pc(2) = 0; vc(2) = 1; np = 2; nv = 3; twot = 0; iephem = 0; end if (ntarg == ncent) return; end %%%%%%%%%%%%%%%%%%%%%% % nutations requested? %%%%%%%%%%%%%%%%%%%%%% if (ntarg == 14) if (ipt(2, 12) > 0) 4. list(11) = 2; [pv, rrd] = state(et2, list); list(11) = 0; return; else fprintf('nnpleph - no nutations on this ephemeris file n'); return; end end %%%%%%%%%%%%%%%%%%%%%%% % librations requested? %%%%%%%%%%%%%%%%%%%%%%% if (ntarg == 15) if (lpt(2) > 0) list(12) = 2; [pv, rrd] = state(et2, list); list(12) = 0; for i = 1:1:6 rrd(i) = pv(i, 11); end return else fprintf('nn no librations on this ephemeris file n'); return; end end % force barycentric output by function 'state' bsave = bary; bary = 1; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % set up proper entries in 'list' array for state call %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% for i = 1:1:2 k = ntarg; 5. if (i == 2) k = ncent; end if (k no interpolation for body i % = 1 => position only % = 2 => position and velocity % the designation of the astronomical bodies by i is: % i = 1 => mercury % = 2 => venus % = 3 => earth-moon barycenter % = 4 => mars % = 5 => jupiter % = 6 => saturn % = 7 => uranus % = 8 => neptune % = 9 => pluto % = 10 => geocentric moon % = 11 => nutations in longitude and obliquity % = 12 => lunar librations (if on file) % output % pv 6 x 11 array that will contain requested interpolated % quantities. the body specified by list(i) will have its % state in the array starting at pv(1, i). (on any given % call, only those words in 'pv' which are affected by the % first 10 'list' entries (and by list(12) if librations are % on the file) are set. the rest of the 'pv' array % is untouched). the order of components starting in % pv(1, i) is x, y, z, dx, dy, dz. % all output vectors are referenced to the earth mean % equator and equinox of j2000 if the de number is 200 or % greater; of b1950 if the de number is less than 200. % the moon state is always geocentric; the other nine states % are either heliocentric or solar-system barycentric, % depending on the setting of common flags (see below). % lunar librations, if on file, are put into pv(k, 11) if % list(12) is 1 or 2. % % nut 4-word array that will contain nutations and rates, % depending on the setting of list(11). the order of % quantities in nut is: % d psi (nutation in longitude) % d epsilon (nutation in obliquity) % d psi dot % d epsilon dot 8. % global % km logical flag defining physical units of the output states % = 1 => kilometers and kilometers/second % = 0 => au and au/day % default value = 0 (km determines time unit % for nutations and librations. angle unit is always radians.) % bary logical flag defining output center. % only the 9 planets are affected. % bary = 1 => center is solar-system barycenter % = 0 => center is sun % default value = 0 % pvsun 6-word array containing the barycentric position and % velocity of the sun global ss au ipt lpt global nrl fid km bary pvsun coef nut = zeros(4, 1); pv = zeros(6, 11); if (et2(1) == 0) return end s = et2(1) - 0.5; tmp = split(s); pjd(1) = tmp(1); pjd(2) = tmp(2); tmp = split(et2(2)); pjd(3) = tmp(1); pjd(4) = tmp(2); pjd(1) = pjd(1) + pjd(3) + 0.5; pjd(2) = pjd(2) + pjd(4); 9. tmp = split(pjd(2)); pjd(3) = tmp(1); pjd(4) = tmp(2); pjd(1) = pjd(1) + pjd(3); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % error return for epoch out of range %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% if (pjd(1) + pjd(4) < ss(1) || pjd(1) + pjd(4) > ss(2)) fprintf('nn error in state - epoch out of range n'); return; end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % calculate record number and relative time in interval %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% nr = fix((pjd(1) - ss(1)) / ss(3)) + 2; if (pjd(1) == ss(2)) nr = nr - 1; end t(1) = ((pjd(1) - ((nr-2) * ss(3) + ss(1))) + pjd(4)) / ss(3); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % read correct record if not in core %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% if (nr ~= nrl) nrl = nr; status = fseek(fid, nr * 8144, 'bof'); coef = fread(fid, 1018, 'double'); end if (km == 1) t(2) = ss(3) * 86400; aufac = 1; else t(2) = ss(3); aufac = 1 / au; end 10. % interpolate barycentric state vector of sun tmpv = zeros(3, 2); ibuf = ipt(1, 11); ncf = ipt(2, 11); na = ipt(3, 11); tmpv = interp(ibuf, t, ncf, 3, na, 2); k = 0; for j = 1:1:2 for i = 1:1:3 k = k + 1; pvsun(k) = tmpv(i, j) * aufac; end end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % check and interpolate bodies requested %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% tmpv = zeros(3, 2); tempv = zeros(6, 1); for i = 1:1:10 if (list(i) ~= 0) ibuf = ipt(1, i); ncf = ipt(2, i); na = ipt(3, i); tmpv = interp(ibuf, t, ncf, 3, na, list(i)); k = 0; for j = 1:1:2 for m = 1:1:3 k = k + 1; tempv(k) = tmpv(m, j); end end for j = 1:1:6 if (i 0 && ipt(2, 12) > 0) ibuf = ipt(1, 12); ncf = ipt(2, 12); na = ipt(3, 12); nut = interp(ibuf, t, ncf, 2, na, list(11)); end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % get librations if requested (and if on file) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% if (list(12) > 0 && lpt(2) > 0) tmpv = interp(lpt(1), t, lpt(2), 3, lpt(3), list(12)); for i = 1:1:3 pv(i, 11) = tmpv(i, 1); pv(i + 3, 11) = tmpv(i, 2); end end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function pv = interp(ibuf, t, ncf, ncm, na, ifl) % this function differentiates and interpolates a set % of chebyshev coefficients to give position and velocity % input % buf 1st location of array of chebyshev coefficients of position % t t(1) is fractional time in interval covered by % coefficients at which interpolation is wanted % (0