Plot velocity over distance(plot over line) from the attached csv file?

5 views (last 30 days)
Hi, I have extracted some data from Image analysis experiment and it extracted in csv file (file is sttached). I want to use the x and y information from column 5 (x mm) and 6(y mm) and column 10 (v m/s) and plot column 5 and 6 information on x-axis and corresponding cploumn 10 info on y-axis
I want to pick the
starting point from column 5 (x=-60) and (y=118) all the way to ending point (x=-391) and (y=118) this will give me the length of 331 mm in x direction at y=118 mm and then plot the corresponding column 10 (v m/s) values on y axis. so I can see how the velocities are changing over the length across the device.
I am looking through the forums and googling since morning but to be honest I couldn't write a single line here
Code:
files = ['F:\3-PIV_Experimental_Data\Outlet_110\ABCD_DesignPoint\Profile_Plot\Center_ABCDlineplot\Average_VectorStiching\Export.6v71h6lu.000002.csv'];
a = readmatrix(files);
%Starting point
%Ending point
%Velocity data
%Plot the velocity over distance

Accepted Answer

Kevin Holly
Kevin Holly on 12 Mar 2022
I'm not quite sure what you are looking for, so here are some techniques:
Load Data as table
[filename, folder] = uigetfile({'.csv'},'F:\3-PIV_Experimental_Data\Outlet_110\ABCD_DesignPoint\Profile_Plot\Center_ABCDlineplot\Average_VectorStiching\');
Data = readtable(fullfile(folder,filename));
Create scatterplot of Velocity (m/s) versus the x and y coordinates (mm)
figure
scatter3(Data.x_mm__mm_,Data.y_mm__mm_,Data.V_m_s_,'.','CData',Data.V_m_s_);
xlabel('x (mm)')
ylabel('y (mm)')
zlabel('Velocity (m/s)')
If you are looking for a 2D plot of the velocity versus the x position when y = 118, then the following would work (note, the velocity is consistently zero.
whenx_between_n60_n391 = find(round(Data.x_mm__mm_)<=-60 & round(Data.x_mm__mm_)>=-391);
whenyis118 = find(round(Data.y_mm__mm_)==118);
index = intersect(whenx_between_n60_n391,whenyis118);
figure
plot(Data.x_mm__mm_(index),Data.V_m_s_(index))
xlabel('x (mm)')
ylabel('Velocity (m/s)')
Look at specific range:
figure
scatter3(Data.x_mm__mm_(3163:18170),Data.y_mm__mm_(3163:18170),Data.V_m_s_(3163:18170),'.','CData',Data.V_m_s_(3163:18170));
xlabel('x (mm)')
ylabel('y (mm)')
zlabel('Velocity (m/s)')
Try different range:
possiblestart_x = find(round(Data.x_mm__mm_)==-61);
possiblestart_y = find(round(Data.y_mm__mm_)==116);
start_index = intersect(possiblestart_x,possiblestart_y);
possibleend_x = find(round(Data.x_mm__mm_)==-391);
possibleend_y = find(round(Data.y_mm__mm_)==119);
end_index = intersect(possiblestart_x,possiblestart_y)
figure
scatter3(Data.x_mm__mm_(start_index:end_index(end)),Data.y_mm__mm_(start_index:end_index(end)),Data.V_m_s_(start_index:end_index(end)),'.','CData',Data.V_m_s_(start_index:end_index(end)));
xlabel('x (mm)')
ylabel('y (mm)')
zlabel('Velocity (m/s)')
  1 Comment
muhammad choudhry
muhammad choudhry on 12 Mar 2022
absolutely legend!! you gave me more then I was looking... Thanks alot again! I am going to break it down and learn bit by bit, thanks alot again!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by