Creating a curved triangular heatmap .

I had a sample of material that resembled a right-angled triangle with a curved hypothenuse, on which I drew a grid to carry out a hardness test (0.5 HV), to see how the hardness varies across the sample surface. It is attached as an Excel spreadsheet 'Raw_data'
I then exported this spreadsheet as a matrix. If it were perfectly rectangular, it would be a 10x16 matrix, however due to it spatially describing a sector of an oval, the number of columns decrease non-uniformly.
I intend to plot the hardness as a function of spatial coordinate as a heatmap. This is my code thus far:
[X,Y] = meshgrid(0:2:30,0:2:18);
Z = Rawdata;
T = delaunay(X,Y);
trisurf(T,X,Y,Z)
view (2)
shading interp
How do I modify this in order to make the edge of the heatmap vary smoothly, i.e remove the steps so that it instead describes the arc of an oval? Thanks so much!

Respuestas (1)

KSSV
KSSV el 20 de Feb. de 2022
Editada: KSSV el 20 de Feb. de 2022
You need not to use delaunayTriangulation. Your grid is already a structured grid and you can striaght away plot using pcolor. You can increase the grid resolution and use interp2 to get smooth variation.
[X,Y] = meshgrid(0:2:30,0:2:18);
T = readtable('https://in.mathworks.com/matlabcentral/answers/uploaded_files/900375/Raw%20data.xlsx') ;
Rawdata = table2array(T) ;
Z = Rawdata;
pcolor(X,Y,Z) ;
shading interp ;
title('Original')
x = linspace(0,30) ;
y = linspace(0,18) ;
[Xi,Yi] = meshgrid(x,y) ;
Zi = interp2(X,Y,Z,Xi,Yi) ;
pcolor(Xi,Yi,Zi) ;
shading interp
title('Interpolated')

1 comentario

Thanks so much for replying so fast. I'll edit my question right after this, but what I meant is how do I make the edge vary smoothly, i.e remove the steps, so that the edge of the heatmap describes the arc of an oval.

Iniciar sesión para comentar.

Categorías

Más información sobre Data Distribution Plots en Centro de ayuda y File Exchange.

Productos

Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by