Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- f = xmlread('/home/ivan/Downloads/sentinel1_position.xml');
- orbits = f.getElementsByTagName('orbit');
- Lo = orbits.getLength;
- d = zeros(1, Lo);
- d = datetime(d, d, d, d, d, d);
- x = zeros(1, Lo);
- y = zeros(1, Lo);
- z = zeros(1, Lo);
- vx = zeros(1, Lo);
- vy = zeros(1, Lo);
- vz = zeros(1, Lo);
- for i = 1:orbits.getLength
- orbit = orbits.item(i-1);
- date = orbit.getElementsByTagName('time').item(0).item(0).getData;
- d(i) = datetime(char(date), 'InputFormat', 'yyyy-MM-dd''T''hh:mm:ss.SSSSSS');
- position = orbit.getElementsByTagName('position').item(0);
- x(i) = str2num(position.getElementsByTagName('x').item(0).item(0).getData);
- y(i) = str2num(position.getElementsByTagName('y').item(0).item(0).getData);
- z(i) = str2num(position.getElementsByTagName('z').item(0).item(0).getData);
- velocity = orbit.getElementsByTagName('velocity').item(0);
- vx(i) = str2num(velocity.getElementsByTagName('x').item(0).item(0).getData);
- vy(i) = str2num(velocity.getElementsByTagName('y').item(0).item(0).getData);
- vz(i) = str2num(velocity.getElementsByTagName('z').item(0).item(0).getData);
- end
- attitudes = f.getElementsByTagName('attitude');
- La = attitudes.getLength;
- t = zeros(1, La);
- t = datetime(t, t, t, t, t, t);
- q0 = zeros(1, La);
- q1 = zeros(1, La);
- q2 = zeros(1, La);
- q3 = zeros(1, La);
- wx = zeros(1, La);
- wy = zeros(1, La);
- wz = zeros(1, La);
- roll = zeros(1, La);
- pitch = zeros(1, La);
- yaw = zeros(1, La);
- for i = 1:attitudes.getLength
- attitude = attitudes.item(i-1);
- date = attitude.getElementsByTagName('time').item(0).item(0).getData;
- t(i) = datetime(char(date), 'InputFormat', 'yyyy-MM-dd''T''hh:mm:ss.SSSSSS');
- q0(i) = str2num(attitude.getElementsByTagName('q0').item(0).item(0).getData);
- q1(i) = str2num(attitude.getElementsByTagName('q0').item(0).item(0).getData);
- q2(i) = str2num(attitude.getElementsByTagName('q0').item(0).item(0).getData);
- q3(i) = str2num(attitude.getElementsByTagName('q0').item(0).item(0).getData);
- wx(i) = str2num(attitude.getElementsByTagName('q0').item(0).item(0).getData);
- wy(i) = str2num(attitude.getElementsByTagName('q0').item(0).item(0).getData);
- wz(i) = str2num(attitude.getElementsByTagName('q0').item(0).item(0).getData);
- roll(i) = str2num(attitude.getElementsByTagName('q0').item(0).item(0).getData);
- pitch(i) = str2num(attitude.getElementsByTagName('q0').item(0).item(0).getData);
- yaw(i) = str2num(attitude.getElementsByTagName('q0').item(0).item(0).getData);
- end
- subplot(2, 3, 1)
- plot(d, x, '.-')
- grid on
- title('x(datetime)')
- subplot(2, 3, 2)
- plot(d, y, '.-')
- grid on
- title('y(datetime)')
- subplot(2, 3, 3)
- plot(d, z, '.-')
- grid on
- title('z(datetime)')
- subplot(2, 3, 4)
- plot(d, x, '.-')
- grid on
- title('Vx(datetime)')
- subplot(2, 3, 5)
- plot(d, x, '.-')
- grid on
- title('Vy(datetime)')
- subplot(2, 3, 6)
- plot(d, x, '.-')
- grid on
- title('Vz(datetime)')
- dnum = datenum(d - d(1));
- tnum = datenum(t - t(1));
- dstr = datestr(d, 'hh:MM:ss');
- tstr = datestr(t, 'hh:MM:ss');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement