Z must be at least a 2x2 matrix

8 vues (au cours des 30 derniers jours)
Rendrick Lopes
Rendrick Lopes le 13 Déc 2019
Modifié(e) : Adam Danz le 16 Déc 2019
x=min(xbm):250:max(xbm);
y=min(ybm):250:max(ybm);
[X,Y]=meshgrid(x,y);
T=scatteredInterpolant(xbm,ybm,ResG,'natural');
plot(xbm,ybm,'ok','MarkerSize',1,'MarkerFaceColor','k');
hold on;
contour(X,Y,T(X,Y),10,'ShowText','on','LineWidth',2);
Error using contour (line 48)
Z must be at least a 2x2 matrix.
why??????

Réponse acceptée

Adam Danz
Adam Danz le 13 Déc 2019
Modifié(e) : Adam Danz le 16 Déc 2019
In this line below from your code, T(X,Y) must be at lease a 2x2 matrix and it apparently is not.
contour(X,Y,T(X,Y),10,'ShowText','on','LineWidth',2);
From the documentation,
contour(X,Y,Z) draws a contour plot of Z using vertices from the
mesh defined by X and Y. X and Y can be vectors or matrices.
If you need more help troubleshooting, please provide the values for the missing variables in your question so we can run your code.
  4 commentaires
Rendrick Lopes
Rendrick Lopes le 13 Déc 2019
I solved the problem. I had multiplied xbm and ybm by 1E-3. XD
Now it work.
Thank you so much for your help.
Adam Danz
Adam Danz le 13 Déc 2019
Great! It's always a good idea to look at the values of the variables to make sure they appear as you expect them to.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by