Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
function [plotHandles] = plotOffsetVariations(pAxesHandle, pVariationResults, pColor)
%PLOTOFFSETVARIATIONS Summary of this function goes here
% Detailed explanation goes here
%% Parameter check
if nargin < 3
pColor = [0 0 0];
end
%% Initialize return variables
plotHandles = {};
%% Prepare variables for plotting
% get plotting positions
lat = cellfun(@(x) x.observations(end, 1), pVariationResults)';
lon = cellfun(@(x) x.observations(end, 2), pVariationResults)';
dates = cellfun(@(x) x.date, pVariationResults)';
%% Plot the eigenvectors and ellipse for every position
hold(pAxesHandle, 'on');
for i = 1:length(dates)
if isnan(dates(i))
continue;
end
currentResults = pVariationResults{i};
d = sqrt(diag(currentResults.D));
% prepare data for ellipse
ecc = axes2ecc(max(d), min(d));
[y, x] = ellipse1(lat(i), lon(i), [max(d) ecc]);
plotHandles = [ ...
plotHandles, ...
{ ...
line([lon(i), lon(i)+currentResults.V(2, 1)*d(1)], [lat(i), lat(i)+currentResults.V(1, 1)*d(2)]), ...
line([lon(i), lon(i)+currentResults.V(2, 2)*d(1)], [lat(i), lat(i)+currentResults.V(1, 2)*d(2)]), ...
plot(x, y, 'Color', pColor) ...
} ...
];
end
hold(pAxesHandle, 'off');
end