Surface plot problem with mesh

9 ビュー (過去 30 日間)
Danila Zharenkov
Danila Zharenkov 2014 年 4 月 10 日
コメント済み: Danila Zharenkov 2014 年 4 月 12 日
Hello, I've got a code that solves pde system. As a result I've got matrix with values in different points (coordinate and time layer). Now I'm trying to plot the surface like this
figure
[x1,y1]=meshgrid(time,x);
surf(x1,y1,u(:,:),'EdgeColor','black');
colormap(copper)
set(gca,'linewidth',2)
shading interp;
grid on;
hold on;
where x and time are vectors of coordinate and time points, u is the result matrix. But the surface looks very strange.
How can I add the lines on this surface? Like this

採用された回答

Mischa Kim
Mischa Kim 2014 年 4 月 10 日
Danila, remove
shading interp;
  6 件のコメント
Mischa Kim
Mischa Kim 2014 年 4 月 11 日
編集済み: Mischa Kim 2014 年 4 月 11 日
Or simply down-sample the matrices. Would this work:
figure;
[x1,y1] = meshgrid(time,x);
xsam = 1:5:size(x1,1); % the 5 sets the lines spacing
ysam = 1:3000:size(x1,2);
surf(x1(xsam,ysam),y1(xsam,ysam),u(xsam,ysam),'EdgeColor','black');
colormap(copper);
You still got all the data (for analysis), for visualization the down-sampled plot should be sufficient.
Danila Zharenkov
Danila Zharenkov 2014 年 4 月 12 日
Thanks! That works.

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

その他の回答 (2 件)

Danila Zharenkov
Danila Zharenkov 2014 年 4 月 10 日
I was trying to remove shading. Here's the result
It's funny, I can't understand what going on with this plot.
  1 件のコメント
Mischa Kim
Mischa Kim 2014 年 4 月 10 日
Please add comments as comments, not answers.

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


Kelly Kearney
Kelly Kearney 2014 年 4 月 10 日
The wireframe function will give the effect you're looking for:
[x,y,z] = peaks(500);
surf(x,y,z);
shading flat;
wireframe(x,y,z,20);

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by