Skip to content
Newer
Older
100755 154 lines (127 sloc) 6.58 KB
0ff1aa5 @kristianpaul Initial import from tarball
authored Mar 22, 2011
1 function plotTracking(channelList, trackResults, settings)
2 %This function plots the tracking results for the given channel list.
3 %
4 %plotTracking(channelList, trackResults, settings)
5 %
6 % Inputs:
7 % channelList - list of channels to be plotted.
8 % trackResults - tracking results from the tracking function.
9 % settings - receiver settings.
10
11 %--------------------------------------------------------------------------
12 % SoftGNSS v3.0
13 %
14 % Copyright (C) Darius Plausinaitis
15 % Written by Darius Plausinaitis
16 %--------------------------------------------------------------------------
17 %This program is free software; you can redistribute it and/or
18 %modify it under the terms of the GNU General Public License
19 %as published by the Free Software Foundation; either version 2
20 %of the License, or (at your option) any later version.
21 %
22 %This program is distributed in the hope that it will be useful,
23 %but WITHOUT ANY WARRANTY; without even the implied warranty of
24 %MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 %GNU General Public License for more details.
26 %
27 %You should have received a copy of the GNU General Public License
28 %along with this program; if not, write to the Free Software
29 %Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
30 %USA.
31 %--------------------------------------------------------------------------
32
33 %CVS record:
34 %$Id: plotTracking.m,v 1.5.2.23 2006/08/14 14:45:14 dpl Exp $
35
36 % Protection - if the list contains incorrect channel numbers
37 channelList = intersect(channelList, 1:settings.numberOfChannels);
38
39 %=== For all listed channels ==============================================
40 for channelNr = channelList
41
42 %% Select (or create) and clear the figure ================================
43 % The number 200 is added just for more convenient handling of the open
44 % figure windows, when many figures are closed and reopened.
45 % Figures drawn or opened by the user, will not be "overwritten" by
46 % this function.
47
48 figure(channelNr +200);
49 clf(channelNr +200);
50 set(channelNr +200, 'Name', ['Channel ', num2str(channelNr), ...
51 ' (PRN ', ...
52 num2str(trackResults(channelNr).PRN), ...
53 ') results']);
54
55 %% Draw axes ==============================================================
56 % Row 1
57 handles(1, 1) = subplot(3, 3, 1);
58 handles(1, 2) = subplot(3, 3, [2 3]);
59 % Row 2
60 handles(2, 1) = subplot(3, 3, 4);
61 handles(2, 2) = subplot(3, 3, [5 6]);
62 % Row 3
63 handles(3, 1) = subplot(3, 3, 7);
64 handles(3, 2) = subplot(3, 3, 8);
65 handles(3, 3) = subplot(3, 3, 9);
66
67 %% Plot all figures =======================================================
68
69 timeAxisInSeconds = (1:settings.msToProcess)/1000;
70
71 %----- Discrete-Time Scatter Plot ---------------------------------
72 plot(handles(1, 1), trackResults(channelNr).I_P,...
73 trackResults(channelNr).Q_P, ...
74 '.');
75
76 grid (handles(1, 1));
77 axis (handles(1, 1), 'equal');
78 title (handles(1, 1), 'Discrete-Time Scatter Plot');
79 xlabel(handles(1, 1), 'I prompt');
80 ylabel(handles(1, 1), 'Q prompt');
81
82 %----- Nav bits ---------------------------------------------------
83 plot (handles(1, 2), timeAxisInSeconds, ...
84 trackResults(channelNr).I_P);
85
86 grid (handles(1, 2));
87 title (handles(1, 2), 'Bits of the navigation message');
88 xlabel(handles(1, 2), 'Time (s)');
89 axis (handles(1, 2), 'tight');
90
91 %----- PLL discriminator unfiltered--------------------------------
92 plot (handles(2, 1), timeAxisInSeconds, ...
93 trackResults(channelNr).pllDiscr, 'r');
94
95 grid (handles(2, 1));
96 axis (handles(2, 1), 'tight');
97 xlabel(handles(2, 1), 'Time (s)');
98 ylabel(handles(2, 1), 'Amplitude');
99 title (handles(2, 1), 'Raw PLL discriminator');
100
101 %----- Correlation ------------------------------------------------
102 plot(handles(2, 2), timeAxisInSeconds, ...
103 [sqrt(trackResults(channelNr).I_E.^2 + ...
104 trackResults(channelNr).Q_E.^2)', ...
105 sqrt(trackResults(channelNr).I_P.^2 + ...
106 trackResults(channelNr).Q_P.^2)', ...
107 sqrt(trackResults(channelNr).I_L.^2 + ...
108 trackResults(channelNr).Q_L.^2)'], ...
109 '-*');
110
111 grid (handles(2, 2));
112 title (handles(2, 2), 'Correlation results');
113 xlabel(handles(2, 2), 'Time (s)');
114 axis (handles(2, 2), 'tight');
115
116 hLegend = legend(handles(2, 2), '$\sqrt{I_{E}^2 + Q_{E}^2}$', ...
117 '$\sqrt{I_{P}^2 + Q_{P}^2}$', ...
118 '$\sqrt{I_{L}^2 + Q_{L}^2}$');
119
120 %set interpreter from tex to latex. This will draw \sqrt correctly
121 set(hLegend, 'Interpreter', 'Latex');
122
123 %----- PLL discriminator filtered----------------------------------
124 plot (handles(3, 1), timeAxisInSeconds, ...
125 trackResults(channelNr).pllDiscrFilt, 'b');
126
127 grid (handles(3, 1));
128 axis (handles(3, 1), 'tight');
129 xlabel(handles(3, 1), 'Time (s)');
130 ylabel(handles(3, 1), 'Amplitude');
131 title (handles(3, 1), 'Filtered PLL discriminator');
132
133 %----- DLL discriminator unfiltered--------------------------------
134 plot (handles(3, 2), timeAxisInSeconds, ...
135 trackResults(channelNr).dllDiscr, 'r');
136
137 grid (handles(3, 2));
138 axis (handles(3, 2), 'tight');
139 xlabel(handles(3, 2), 'Time (s)');
140 ylabel(handles(3, 2), 'Amplitude');
141 title (handles(3, 2), 'Raw DLL discriminator');
142
143 %----- DLL discriminator filtered----------------------------------
144 plot (handles(3, 3), timeAxisInSeconds, ...
145 trackResults(channelNr).dllDiscrFilt, 'b');
146
147 grid (handles(3, 3));
148 axis (handles(3, 3), 'tight');
149 xlabel(handles(3, 3), 'Time (s)');
150 ylabel(handles(3, 3), 'Amplitude');
151 title (handles(3, 3), 'Filtered DLL discriminator');
152
153 end % for channelNr = channelList
Something went wrong with that request. Please try again.