How to plot contour without interpolation on a nonuniform grid?
38 views (last 30 days)
Show older comments
Hi. The data I wish to plot (or post-process) is CFD data (vorticity, pressure, etc) from fluent. The grid is non-uniform, as the image shows, with a finner mesh near the square cavity.
Obviously I can use either 'scatteredinterpolate' or 'griddata' with a regenerated grid, like:
xmin = min(xx); xmax = max(xx);
ymin = min(yy); ymax = max(yy);
[x,y]=meshgrid(xmin:1e-3:xmax,ymin:1e-3:ymax);
vq = griddata(xx,yy,Vort,x,y);
However, I think this interpolation compromises the integrity of my data, since many details may be lost. I thought of using 'reshape', but since the grid is not non-uniform, this becomes very difficult. I attempted creating a uniform grid with lots of 'NaN' indicating no data. But plotting it just gave me no data at all. I have attached my code. The data is too big for attachment ~300Mb. Can someone please help? Much appreciated.
0 Comments
Answers (1)
Star Strider
on 15 Jun 2019
Have you experimented to see how contour (or contourf) works with your data? Did the function throw an error?
If not, just let contour (or contourf) loose on your data and see what the result is.
The function is reasonably robust.
Example:
x = randn(10);
y = randn(10);
z = randn(10);
figure
contourf(x, y, z, 'LineStyle','none')
1 Comment
Abdallah Ghazal
on 26 Oct 2020
Hi, I have a similar problem. I want to plot a contour with the original data for a nonuniform grid. The output file that I want to draw gives X, Y and Z as vectors, therefore, the contourf will not work. Any suggestions?
See Also
Categories
Find more on Contour Plots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!