Mathematica I need an help with Mathematica 8

  • Thread starter Thread starter kurt1989
  • Start date Start date
  • Tags Tags
    Mathematica
AI Thread Summary
To create a velocity contour map from a CSV file in Mathematica, the data must be structured with x and y coordinates in the first two columns and velocity values in the third. If the data is organized correctly, the command `velocity = Partition[Import["yourfile.csv"][[All, 3]], n]` can be used to extract the velocity values and format them into a rectangular matrix, where 'n' represents the number of horizontal pixels. Subsequently, `ListContourPlot[velocity]` will generate the desired contour plot. If the points are not in the correct order, sorting may be necessary before extracting the third column. In cases where not all points are available, `ListInterpolation` may be an option, although it complicates the process.
kurt1989
Messages
1
Reaction score
0
Hello everybody!
I'm a new member and I don't know if it is the right section, but I have some problem with the software mathematica so I'm here hoping that someone can help me..

I have a csv file and I have to plot it, but I don't know which function I have to use. The csv file contains 3 columns:the first and the second are the coordinates x y in pixels and the third is the form of the velocity vector. I need to obtain a plot that gives me the velocity countur map.

Someone has an idea??

Thanks to everybody
 
Physics news on Phys.org
If your spreadsheet data is in the form of
1,1, 2
1,2, 5
1,3, 2
1,4, 7
2,1, 4
2,2, 5
2,3, 5
2,4, 6
3,1, 2
3,2, 3
3,3, 3
3,4, 4
where your x,y are in order with every point present and you have n pixels horizontally then

velocity=Partition[Import["yourfile.csv"][[All,3]],n];

which will extract your third column and format it into a rectangular matrix. Then

ListContourPlot[velocity]

should give you your velocity contour plot.

If you have all those points, but they are not in the correct order, then you might be able to sort your rows into order, then select the last column with [[All,3]] and then ListContourPlot the result.

If you don't have all those points and can't get them then I don't know what to tell you. You might be able to use ListInterpolation, but this is getting more and more complicated and I don't want to toss you in the deep end of the pool, yet.
 
Last edited:
Bill Simpson said:
If your spreadsheet data is in the form of
1,1, 2
1,2, 5
1,3, 2
1,4, 7
2,1, 4
2,2, 5
2,3, 5
2,4, 6
3,1, 2
3,2, 3
3,3, 3
3,4, 4
where your x,y are in order with every point present and you have n pixels horizontally then

velocity=Partition[Import["yourfile.csv"][[All,3]],n];

which will extract your third column and format it into a rectangular matrix. Then

ListContourPlot[velocity]

should give you your velocity contour plot.

If you have all those points, but they are not in the correct order, then you might be able to sort your rows into order, then select the last column with [[All,3]] and then ListContourPlot the result.

If you don't have all those points and can't get them then I don't know what to tell you. You might be able to use ListInterpolation, but this is getting more and more complicated and I don't want to toss you in the deep end of the pool, yet.
thanks for your help... :wink::wink::wink::wink:
 

Similar threads

Replies
4
Views
2K
Replies
1
Views
3K
Replies
23
Views
3K
Replies
1
Views
2K
Back
Top