Hello Ara
To plot GPS time in both Universal Time (UT) and Local Time (LT), you need to convert the GPS time to hours and then adjust for the local time zone difference from UT. MATLAB makes these conversions straightforward.
I am assuming you have a vector of GPS times in seconds and want to plot some corresponding data, here's how you could do it:
- Convert GPS Time to Hours
First, convert your GPS time from seconds to hours to make it easier to plot on a 0-24 hour scale.
gpsTimeHours = gpsTimeSeconds / 3600;
2. Adjust for Local Time
Determine the offset of your local time zone from UT. For example, if you are in Eastern Daylight Time (EDT), the offset is -4 hours from UT.
localTimeHours = gpsTimeHours + localTimeOffset;
localTimeHours = mod(localTimeHours, 24);
3. Plotting
Now, you can plot your data against both UT and LT. Assuming you have a vector `data` that corresponds to the measurements taken at the GPS times:
plot(gpsTimeHours, data);
title('Measurement vs. Universal Time');
plot(localTimeHours, data);
xlabel(['Time (LT, offset ' num2str(localTimeOffset) ' hrs)']);
title('Measurement vs. Local Time');
This code will generate a figure with two subplots: one plotting your data against Universal Time and the other against Local Time.