[Users-fr] affichage 2D de matrice

sgougeon at free.fr sgougeon at free.fr
Ven 7 Mar 22:45:46 CET 2014


> -->X(1:5,1:5)
>  ans  =
>
>   - 38.873948  - 38.779007  - 38.684192  - 38.589505  - 38.494945
>   - 37.85452   - 37.760255  - 37.666116  - 37.572103  - 37.478216
>   - 36.834933  - 36.741344  - 36.64788   - 36.554542  - 36.461328
>   - 35.815186  - 35.722273  - 35.629485  - 35.536821  - 35.444282
>   - 34.795279  - 34.703043  - 34.610931  - 34.518942  - 34.427076
>
> -->Y(1:5,1:5)
>  ans  =
>
>   - 38.348145  - 37.045021  - 35.743643  - 34.444008  - 33.146112
>   - 38.351151  - 37.047922  - 35.746441  - 34.446702  - 33.148702
>   - 38.354156  - 37.050824  - 35.749239  - 34.449396  - 33.151293
>   - 38.357163  - 37.053726  - 35.752037  - 34.452091  - 33.153885
>   - 38.360169  - 37.056629  - 35.754836  - 34.454786  - 33.156477
> -->data(1:5,1:5)
>  ans  =
>
>     361.36567    363.89887    362.30396    361.63436 363.50173
>     355.32577    352.35042    355.32577    355.18551 354.76388
>     346.1994     346.34917    347.83765    345.59862 347.54128
>     346.79746    346.1994     346.94656    344.84378 349.01665
>     344.9951     346.04946    344.84378    346.1994 348.28099 

Aa! donc vos x et y sont quand même bien rangés ! Ce qui permet d'utiliser:

X = [
   -38.873948  -38.779007  -38.684192  -38.589505  -38.494945
   -37.85452   -37.760255  -37.666116  -37.572103  -37.478216
   -36.834933  -36.741344  -36.64788   -36.554542  -36.461328
   -35.815186  -35.722273  -35.629485  -35.536821  -35.444282
   -34.795279  -34.703043  -34.610931  -34.518942  -34.427076
   ];
Y = [
   -38.348145  -37.045021  -35.743643  -34.444008  -33.146112
   -38.351151  -37.047922  -35.746441  -34.446702  -33.148702
   -38.354156  -37.050824  -35.749239  -34.449396  -33.151293
   -38.357163  -37.053726  -35.752037  -34.452091  -33.153885
   -38.360169  -37.056629  -35.754836  -34.454786  -33.156477
   ];
M = [
     361.36567    363.89887    362.30396    361.63436 363.50173
     355.32577    352.35042    355.32577    355.18551 354.76388
     346.1994     346.34917    347.83765    345.59862 347.54128
     346.79746    346.1994     346.94656    344.84378 349.01665
     344.9951     346.04946    344.84378    346.1994 348.28099
    ];

surf(X,Y,M);
ax = gca();
ax.view = "2d";
// pour modifier la colormap, je vous laisse faire.

Samuel



Plus d'informations sur la liste de diffusion users-fr