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