MATLAB Answers

0

Plot trajectory colorized according to the standard deviation

Asked by Amer Al-Radaideh on 15 Jun 2018 at 2:40
Latest activity Edited by Kaushik Lakshminarasimhan on 15 Jun 2018 at 3:35

I have a set of data (Latitude(x), Longitude(y)) and their standard deviation. I want to plot the X-Y trajectory but I need it to be colorized (like temperature distribution) according to the standard deviation of each point. This is the trajectory:

So I want the trajecory somehow colored according to the standard deviation like the following figure, this help me see the relation between the trajectory and the corresponding std at each point, I have tried with the errorbar function but that is not helping.

  0 Comments

Sign in to comment.

2 Answers

Answer by KSSV
on 15 Jun 2018 at 3:26

n = 100;
x = linspace(-10,10,n); y = x.^2;
z = zeros(size(x));
col = x;  % This is the color, vary with x in this case.
surface([x;x],[y;y],[z;z],[col;col],...
        'facecolor','no',...
        'edgecolor','interp',...
        'linewidth',2);

  0 Comments

Sign in to comment.


Answer by Kaushik Lakshminarasimhan on 15 Jun 2018 at 3:34
Edited by Kaushik Lakshminarasimhan on 15 Jun 2018 at 3:35

Plot your data as a surface with zero height.

x = vector_of_latitudes;
y = vector_of_longitudes;
z = zeros(size(x)); % surface has zero height
clr = vector_of_standard_deviations; % vector of colors
surface([x;x],[y;y],[z;z],[clr ;clr],'edgecol','interp');

  0 Comments

Sign in to comment.


Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today