Surf plot using meshgrid.

1 回表示 (過去 30 日間)
mick777
mick777 2014 年 8 月 19 日
コメント済み: mick777 2014 年 8 月 19 日
I have a surf plot:
Nx=5; % let it be an odd number for symmetry
Ny=5;
Nx1=Nx-1;
Ny1=Ny-1;
R= 5; %peak1
L=-5; %peak2
d=2; % distance between the two peaks
l=2; % length of each peak
V=zeros(Nx,Ny);
V((Nx1/2)-1,((Ny1/2)+1-(l/2)):((Ny1/2)+1+(l/2)))=R;
V((Nx1/2)-1+d,((Ny1/2)+1-(l/2)):((Ny1/2)+1+(l/2)))=L;
V=V';
h = meshgrid(V);
surf(h);
The plot gives me the meshgrid dimensions beginning at (1,1) until (25,25) on the xy plane. How can I plot the mesh beginning at (0,0)?
How can I plot the value 'V' on a meshgrid(0:1:25,0:1:25)? Any suggestions or corrections would be really helpful.

採用された回答

Björn
Björn 2014 年 8 月 19 日
You can specify the x- and y-vector to a scale of your own choice instead of plotting it at it's index:
x=linspace(0,25,25);
y=linspace(0,25,25);
h = meshgrid(V);
surf(x,y,h);
  1 件のコメント
mick777
mick777 2014 年 8 月 19 日
worked great. Thanks

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by