How to set the xy blocks in SURF plot as squares?

Hi all,
I have a set of x,y,z data as follows:
x =
0.1 0.31623 1 3.1623 10
y =
-1 -0.75 -0.5 -0.25 0 0.25 0.5 0.75 1
z =
0.36602 0.1774 0.18262 0.22931 0.23142
0.35639 0.28053 0.26868 0.26152 0.22932
0.41203 0.36037 0.3113 0.26592 0.21948
0.42282 0.36818 0.30538 0.25642 0.20567
0.34572 0.31703 0.28316 0.24251 0.19116
0.28834 0.28187 0.26377 0.2291 0.17855
0.27488 0.26436 0.24923 0.21842 0.16904
0.25749 0.25185 0.23936 0.21088 0.16254
0.24742 0.24423 0.23309 0.20598 0.15839
I plot a surface using this:
K>> surf(x, y, eSurf)
K>> view(2)
Matlab gives me this plot:
we can see that the blocks are rectangular but the entire plot is square, is there a way to make the blocks square but the plot rectangular?
Many thanks!

 Risposta accettata

pcolor(x, y, z)
set(gca, 'XScale', 'log', 'dataaspectratio', [10 1 1])

3 Commenti

Thanks Walter, this solved my problem. However if I rotate the plot, it is a flat surface (different from the original surface), is there a way to be able to maintain the original surface while using square blocks?
You can use surf(x,y,z); view(2) instead of pcolor(x,y,z)
Oh yes, thanks a lot!

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by