How can i remove irrelevant information in plotting

Hello, i have plotted for error but seems like i have been getting a lot of noise in image. i want to only get the "Orange" highlighted path instead of shaded "grey-black" part. Any suggestions enclosing image below.

9 commentaires

Voss
Voss le 19 Fév 2022
Please share the code and data necessary to generate that plot.
Hey can i mail you the requirement ? Project is confidential.
Voss
Voss le 19 Fév 2022
Sorry, I don't read emails.
Perhaps you could construct a similar case (i.e., one that exhibits the same problematic behavior) using made-up data, and share that. Doing that may also give you insight on how to fix the problem.
Ok, i hope i can explain my problem here,
Estimated_Lat = 180 / pi * lat; %Dimension of (1x17341)
Estimated_Long = 180 / pi * lon; %Dimension of (1x17341)
figure;
plot(Estimated_Long, Estimated_Lat,'x','Linewidth',0.5);
hold on
Ground_Truth = xlsread('27');
G_Long = Ground_Truth(:,1); (43x1)
G_Lat = Ground_Truth(:,2); (43x1)
plot(G_Long,G_Lat,'-x','Linewidth',2)
hold off
ylabel('Latitude, [deg]','FontSize', 13);
xlabel('Longitude, [deg]','FontSize', 13);
title('Trajectory of vehicle with position close to Lane level','FontSize', 14)
legend('Estimated trajectory', 'Centre nodes of True trajectory','best')
% To find error between estimated and true trajectory, i used difference as shown below
Error_dataLat = G_Lat - 180 / pi * lat; (43x17341)
Error_dataLong = G_Long - 180 / pi * lon; (43x17341)
plot(Error_dataLong,Error_dataLat)
[ This is the image i have shared below, where instead of only highleghted area more of noise is available ]
OK, so the figure is showing just Error_dataLat vs Error_dataLong (because hold is turned off after plotting the previous lines), and each of these are matrices of size 43-by-17341. When you use plot() with matrices, you get one line for each column of the matrix, so that's 17341 lines in this case (each with 43 data points). The line colors cycle through the axes' ColorOrder, and the lines are all on top of one another, so that's why the plot looks like a shaded grey-black region like that.
Rather than plotting those matrices as 17341 lines, maybe it is better to visualize them as two surfaces, something like this (I don't have your data, so I used random numbers but you can just comment out my surf(randn(...)) lines and uncomment the preceding lines that use your variables Error_dataLat/Error_dataLong, and see how that looks):
figure()
subplot(2,1,1);
% surf(Error_dataLat,'EdgeColor','none');
surf(randn(43,17341),'EdgeColor','none');
view([0 90]);
colorbar();
title('Lat Error');
subplot(2,1,2);
% surf(Error_dataLong,'EdgeColor','none');
surf(randn(43,17341),'EdgeColor','none');
view([0 90]);
colorbar();
title('Long Error');
Hi, there thank you for explaining me the problem. I used your code and have figure, but is it possible for you to explain what actually figure is visualizing. I mean what is figure telling about the errors plotted ?
Recall, the errors are defined like this:
Error_dataLat = G_Lat - 180 / pi * lat;
Error_dataLong = G_Long - 180 / pi * lon;
So, yellow color in the surfaces means relatively high positive error (meaning G_Lat > 180 / pi * lat, or, respectively, G_Long > 180 / pi * lon) and blue means high (in magnitude) negative error (so G_Lat < 180/pi*lat, resp., lon).
However, usually error is defined to be in terms of absolute value of the difference if we don't care whether it's positive or negative and we just care about the magnitude, e.g.:
Error_dataLat = abs(G_Lat - 180 / pi * lat);
Error_dataLong = abs(G_Long - 180 / pi * lon);
and that might be more instructive to look at. In that case yellow will be high error using the new definition (i.e., high in magnitude, positive or negative, using the old definition) and blue will be low error (that is, closer to 0, so a better match).
I don't know what the 2 dimensions of the lat/long matrices represent, so I can't comment on what the "spatial" variation across the surface in X or Y might mean.
Thank you verymuch for your valuable time, your help was very useful for me. :)
Voss
Voss le 20 Fév 2022
Glad I could help!

Connectez-vous pour commenter.

Réponses (0)

Commenté :

le 20 Fév 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by