Problem with contourf for scattered data

11 vues (au cours des 30 derniers jours)
Cyril Basalaev
Cyril Basalaev le 15 Mai 2019
Hello!
I have a table with 3 columns (x,y,value) for scattered data from the image like this.
But when I take griddata and then contouf, I get such a plot with strange netted area (in the bottom). Blue points are my sctttered data
Area in the bottom large (small bubbles):
So the question is what am i doing wrong? Why do I get these netted areas instead of great filled areas? Why i get it i these places and others are ok&
Listing of my code, table in attachments
[xq,yq] = meshgrid(0:1:3550, 0:1:2550); % interpolation points grid
vq = griddata(x,y,values,xq,yq,'natural');
Z = squeeze(vq);
grid on
[hq,hqlbl] = contourf(xq,yq,Z);
clabel(hq,hqlbl)
colorbar ('Direction','reverse')
caxis([-60 20])
  2 commentaires
Cris LaPierre
Cris LaPierre le 15 Mai 2019
Modifié(e) : Cris LaPierre le 15 Mai 2019
Which column contains value? Your spreadsheet has 10 columns in it. X and Y are obvious, but not sure what you want to use for elevation.
Perhaps you could describe what it is you are trying to do? If you could explain what you want your final result to be, we can better help you decide what it is you should do.
Cyril Basalaev
Cyril Basalaev le 15 Mai 2019
Hi, Cris!
Other 8 columns are values for different dates. I've taken X,Y and one of the last. Then I plan to make *.mp4 file with time-varying values. But now I'm just trying to get at least one good contourf plot without these strange black "netted" (bubled?) areas.
I noticed each netted area is specific for different column of values from xls-file, but can't find a relation between values and countourf results, as long as the reason for appearance of these bubbles in some areas :-(

Connectez-vous pour commenter.

Réponse acceptée

Cris LaPierre
Cris LaPierre le 15 Mai 2019
Modifié(e) : Cris LaPierre le 15 Mai 2019
I didn't look into what is causing it, but inspecting Z has me thinking it might be roundoff error. Your Z values in this region are varying between 1 and 1.0000. Since your contour line is for Z==1, I suspect it is trying to create a contour line around each 1.0000 "island".
I was able to clear it up for the 1/23/2017 data by adding round to the following code:
Z = squeeze(round(vq,4));
  1 commentaire
Cyril Basalaev
Cyril Basalaev le 20 Mai 2019
Modifié(e) : Cyril Basalaev le 20 Mai 2019
Oh, yes, it works! Thanks a lot, have faced this error for the first time.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Data Distribution Plots dans Help Center et File Exchange

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by