Contour plots with irregular grids

88 Ansichten (letzte 30 Tage)
CAL
CAL am 28 Okt. 2020
Kommentiert: Jack Lavender am 4 Okt. 2021
Hi,
I am trying to create a filled contour plot with my x axis(first column), y axis(second column), and temperature(third column) data. I tried plotting it using griddata but it interpolates my data incorrectly. Is there any way I can plot the contour plots? I have attached my data for the coordinates and temperature and a figure of the contour of how it should look like.
Thank you.

Akzeptierte Antwort

Akira Agata
Akira Agata am 28 Okt. 2020
How about the following?
% Read data file
tData = readtable('data.xlsx');
tData.Properties.VariableNames = {'x','y','TEMP'};
% Apply interpolation
[x1,y1] = meshgrid(-0.045:0.00005:-0.02, 0.01:0.00005:0.035);
z1 = griddata(tData.x, tData.y, tData.TEMP, x1, y1);
% Set the TEMPs outside the measured area to NaN
k = boundary(tData.x, tData.y, 1);
pgon = polyshape(tData.x(k), tData.y(k),'Simplify',false);
idx = isinterior(pgon,x1(:),y1(:));
idx = reshape(idx,size(x1));
z1(~idx) = nan;
% Show the result
figure
contourf(x1,y1,z1,'ShowText','on');
caxis([-50 441]);
axis equal
xlabel('x, (mm)')
ylabel('y, (mm)')
title('temperature(C)@213k800ms contour plot')
colorbar
  2 Kommentare
CAL
CAL am 2 Nov. 2020
Thank you very much for the solution and have a good day!
Jack Lavender
Jack Lavender am 4 Okt. 2021
Hi, I have a similar problem:
It's the result of a CFD simulation with periodic boundaries so to view it I'm copying a data set twice with a shift in x and y.
There are duplicate points in the resultant set of points. It has an irregular boundary and internal holes.
This is what I'm hoping for (except not ctrl v):
and this is what I have so far.
thank you very much in advance for your time!
Jack

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Contour Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by