maps contourf, griddatat or scatterdata

1 vue (au cours des 30 derniers jours)
Mohamed le 25 Fév 2023
Commenté : Mohamed le 26 Fév 2023
I'am trying to replot may hardness mesurement that i get from the machine
I get three data vector x, y, and h
the maps that i get from the machine is like the one below
when i replot the data with matlap i get the one below
Could anyone please give me ideas how to replot the data to get better resoltion and interpolation
thanks in adavanced
  2 commentaires
John D'Errico
John D'Errico le 25 Fév 2023
I think too many get spoiled by tv shows and movies, where starting with a massively blurred picture about 3 pixels wide, they sharpen it in second, to then be able to read a license plate through a mirror, as well as the face of the perpetrator, complete with a tiny mole on their face and to know the color of their eyes.
Exactly what do you think should be the result of this hoped for resolution improvement? The plots you show seem reasonable, and consistent.
William Rose
William Rose le 25 Fév 2023
Great comment, @John D'Errico!

Connectez-vous pour commenter.

Réponse acceptée

William Rose
William Rose le 25 Fév 2023
I assume you have data at the specific points shown on the Matlab plot. If that is true, then the Matlab plot looks very good to me.
Use interp2() to interpolate your original data to a finer grid. Then use contourf() on the interpolated data set.
Since your samples do not cover a full rectangular grid, use the extrapval argument to interp2(), to specify the value to use outside the sampled area.
The sampled points are not on a grid aligned with the plotted x and y, and points in the corners and along one edge are not sampled. Therefore you will have to use the "scattered points" way of specifying the measured data when you call interp2() - see here.
Try different "methods" with interp2(): maybe you will like the visual appearance of the contours more with certain methods.
I suspect you will get good help on this if you post the data file and the code you used to generate the plot.
  1 commentaire
Mohamed le 26 Fév 2023
thanks for your answer
here is an exmple of a file that i use
and exemple of a code
%% Read data
M = readmatrix('E_2022_11Cr_ODS_03.csv');
%% Get data from csv file
x1 = M(:, 1);
y1 = M(:, 2);
d1 = M(:, 3);
%% plot hardness maps
%Create regular grid across data space
[X,Y] = meshgrid(linspace(min(x1),max(x1), n), linspace(min(y1),max(y1)), n);
g1 = griddata (x1,y1,d1, X,Y, 'cubic');

Connectez-vous pour commenter.

Plus de réponses (0)


Community Treasure Hunt

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

Start Hunting!

Translated by