how to change grid option(size of grid & granularity)
14 ビュー (過去 30 日間)
古いコメントを表示
i have this mask.and display that by meshc function?
z=[ 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000;
-0.0005 -0.0001 0.0000 0.0000 0.0000 0.0000;
0.0038 0.0001 -0.0005 -0.0000 0.0000 0.0000;
0.0074 0.0066 0.0027 -0.0003 0.0000 0.0000;
0.0054 0.0067 0.0078 0.0011 -0.0001 0.0000;
0.0000 0.0000 0.0000 0.0000 0.0000 0.0000];
meshc(z)
how to change grid option like this image :
0 件のコメント
採用された回答
Star Strider
2015 年 12 月 6 日
編集済み: Star Strider
2015 年 12 月 6 日
EDIT — To illustrate (literally):
og = [1:6]; % Original Grid (Vector)
[X,Y] = meshgrid(og); % Original Grid (Matrices)
qg = linspace(min(og), max(og), 25); % Query Grid (Vector)
[Xq,Yq] = meshgrid(qg); % Query Grid (Matrices)
zq = interp2(X,Y,z,Xq,Yq, 'spline'); % Interpolated ‘z’
figure(1)
meshc(Xq, Yq, zq)
grid on
Explore the options (grid size, interpolation method, etc.) presented in the interp2 documentation.
6 件のコメント
Star Strider
2015 年 12 月 6 日
First — The ‘6’ in the original ‘x’ vector was used to create the (6x6) [X,Y] matrices necessary to provide an original independent variable reference for interp2, since ‘z’ is (6x6). The ‘25’ is simply the arbitrary length of the vector I used to create the [Xq,Yq] ‘query’ matrices for interp2. Any length will work, providing it produces a readable plot.
Second — If you want the interpolation matrices to be (15x16), create vectors to use in meshgrid to produce the appropriate ‘query’ matrices.
Third — Thank you, Image Analyst!
The code to produce a (15x16) interpolated grid:
og = [1:6]; % Original Grid (Vector)
[X,Y] = meshgrid(og); % Original Grid (Matrices)
qgx = linspace(min(og), max(og), 16); % Query Grid (X-Vector) (1x16)
qgy = linspace(min(og), max(og), 15); % Query Grid (Y-Vector) (1x15)
[Xq,Yq] = meshgrid(qgx, qgy); % Query Grid (Matrices) (15x16)
zq = interp2(X,Y,z,Xq,Yq, 'spline'); % Interpolated ‘z’
figure(1)
meshc(Xq, Yq, zq)
grid on
You can change the ‘qgx’ (query grid x) vector and ‘qgy’ vector to be anything you want. Experiment with other options available in the interp2 function.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Surface and Mesh Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!