Plot surfaces with random peaks

조회 수: 35 (최근 30일)
Tejas
Tejas 2020년 6월 24일
댓글: Seeven Amic 2022년 5월 28일
I'm working on a project where I want to run random walks on 3D surfaces with multiple peaks. In order to do this, I'm looking for a good way to generate surfaces with random peaks. It'd be preferred that they are continuous surfaces and resemble an actual landscape. I found the 'peaks' function of Matlab especially helpful. I also cannot have valleys, but a simple changing of signs of the variable 'z' wherever it was negative gave me a pretty good landscape.
Are there any other ways that I can create such surfaces in Matlab? In the best case, I'd have a function where changing a few parameters can give me surfaces with peaks at random locations and random heights. But any help in this direction is much appreciated. Thank you.
  댓글 수: 1
Seeven Amic
Seeven Amic 2022년 5월 28일
Can you share the code for the above surface plot? Thanks

댓글을 달려면 로그인하십시오.

채택된 답변

darova
darova 2020년 6월 24일
What about griddata?
x = rand(20,1);
y = rand(20,1);
z = rand(20,1);
[x1,y1] = meshgrid(0:0.05:1);
z1 = griddata(x,y,z,x1,y1,'cubic');
plot3(x,y,z,'.r')
surface(x1,y1,z1)
  댓글 수: 1
Tejas
Tejas 2020년 7월 13일
This helps me. Thank you!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by