I am trying to plot a 2D figure (x,y) and add 3rd axis (velocity) by variation the color through the path. I did code and add related colorbar. In fact I would like to show each point by corresponding velocity value by changing color that colorbar already shows. However, I don't have any idea how I can vary the velocity. My solution that I already used not show the exact velocity values. I also attached the data. Any idea? Thanks in advance
Elnaz
close allclear allclc%%
load data3x =data (:,1); %X
y =data (:,2); %Y
z =data (:,3); %Mean velocity
z_min=min(min(z));z_max=max(max(z));x_min=min(min(x));x_max=max(max(x));y_min=min(min(y));y_max=max(max(y));dt=(6.95:0.05:19.5);figure % new figure
title ('Trajectory of Particles')grid onxlabel('X (m)')yyaxis rightplot(x,y,'k--o','LineWidth',2,'MarkerEdgeColor','r','MarkerFaceColor','none');ylabel('Y(m)')yyaxis leftplot(x,z,'w');ylabel('Mean Velocity(m/sec)')c = colorbar;c.Label.String = 'Mean Velocity(m/sec)';caxis([z_min z_max]);
Best Answer